Macro assertables::assert_fn_err_string_le [−][src]
macro_rules! assert_fn_err_string_le { ($function:path, $left:expr, $right:expr $(,)?) => { ... }; ($function:path, $left:expr, $right:expr, $($arg:tt)+) => { ... }; }
Expand description
Assert one function ok() is less than or equal to another function ok().
-
When true, return
(). -
Otherwise, call
panic!with a message and the values of the expressions with their debug representations.
Example
fn f(i: i32) -> Result<bool, String> { Err(format!("{:?}", i)) } assert_fn_err_string_le!(f, 1, 2); //-> ()
// fn f(i: i32) -> Result<bool, String> { Err(format!("{:?}", i)) } // assert_fn_err_string_le!(f, 2, 1); //-> panic!("assertion failed: `assert_fn_err_string_le(fn, left, right)`\n left input: `2`\n right input: `1`\n left output: `\"2\"`\n right output: `\"1\"`")
This macro has a second form where a custom message can be provided.