Skip to main content

Module assert_fn_err_gt_x

Module assert_fn_err_gt_x 

Source
Expand description

Assert a function Err(…) is greater than an expression.

Pseudocode:
(function(param) ⇒ Err(a) ⇒ a) > expr

§Example

use assertables::*;
fn f(i: i8) -> Result<String, String> {
    match i {
        0..=9 => Ok(format!("{}", i)),
        _ => Err(format!("{:?} is out of range", i)),
    }
}

let a: i8 = 20;
let b = String::from("10 is out of range");
assert_fn_err_gt_x!(f, a, b);

§Module macros