macro_rules! assert_err_ne_x {
($a:expr, $b:expr $(,)?) => { ... };
($a:expr, $b:expr, $($message:tt)+) => { ... };
}Expand description
Assert an expression is Err and its value is not equal to an expression.
Pseudocode:
(a ⇒ Err(a1) ⇒ a1) ≠ b
-
e, return
a1. -
Otherwise, call
panic!with a message and the values of the expressions with their debug representations.
§Examples
use assertables::*;
let a: Result<i8, i8> = Err(1);
let b: i8 = 2;
assert_err_ne_x!(a, b);
// This will panic
let a: Result<i8, i8> = Err(1);
let b: i8 = 1;
assert_err_ne_x!(a, b);
// assertion failed: `assert_err_ne_x!(a, b)`
// https://docs.rs/assertables/…/assertables/macro.assert_err_ne_x.html
// a label: `a`,
// a debug: `Err(1)`,
// a inner: `1`,
// b label: `b`,
// b debug: `1`