Macro assertables::assume_fn_err_string_ne[][src]

macro_rules! assume_fn_err_string_ne {
    ($function:path, $left:expr, $right:expr $(,)?) => { ... };
    ($function:path, $left:expr, $right:expr, $($arg:tt)+) => { ... };
}
Expand description

Assume one function ok() is not equal to another function ok().

  • When true, return Ok(true).

  • Otherwise, return Err with a message and the values of the expressions with their debug representations.

Example

fn f(i: i32) -> Result<bool, String> { Err(format!("{:?}", i)) }
assume_fn_err_string_ne!(f, 1, 2);
//-> Ok(true)
fn f(i: i32) -> Result<bool, String> { Err(format!("{:?}", i)) }
assume_fn_err_string_ne!(f, 1, 1);
//-> Err("assumption failed: `assume_fn_err_string_ne(left, right)`\n  left input: `1`\n right input: `1`\n  left output: `\"1\"`\n right output: `\"1\"`")

This macro has a second form where a custom message can be provided.