assertables

Macro assert_ok_ne_expr

source
macro_rules! assert_ok_ne_expr {
    ($a:expr, $b:expr $(,)?) => { ... };
    ($a:expr, $b:expr, $($message:tt)+) => { ... };
}
Expand description

Assert an expression is Ok(_) and its value is equal to an expression.

Pseudocode:
(a ⇒ Ok(a̅) ⇒ a̅) ≠ b

  • If true, return ().

  • Otherwise, call panic! with a message and the values of the expressions with their debug representations.

§Examples

let a: Result<i8, i8> = Ok(1);
let b: i8 = 2;
assert_ok_ne_expr!(a, b);

let a: Result<i8, i8> = Ok(1);
let b: i8 = 1;
assert_ok_ne_expr!(a, b);
// assertion failed: `assert_ok_ne_expr!(a, b)`
// https://docs.rs/assertables/8.9.0/assertables/macro.assert_ok_ne_expr.html
//  a label: `a`,
//  a debug: `Ok(1)`,
//  a inner: `1`,
//  b label: `b`,
//  b debug: `1`

§Module macros