Macro assertables::assert_err
source · macro_rules! assert_err { ($a:expr $(,)?) => { ... }; ($a:expr, $($message:tt)+) => { ... }; }
Expand description
Assert expression is Err(_).
Pseudocode:
a is Err(_)
-
If true, return
(). -
Otherwise, call
panic!with a message and the values of the expressions with their debug representations.
§Examples
let a: Result<(), i8> = Err(1);
assert_err!(a);
let a: Result<(), i8> = Ok(());
assert_err!(a);
// assertion failed: `assert_err!(a)`
// https://docs.rs/assertables/8.7.0/assertables/macro.assert_err.html
// a label: `a`,
// a debug: `Ok(())`