macro_rules! assert_none {
($a:expr $(,)?) => { ... };
($a:expr, $($message:tt)+) => { ... };
}Expand description
Assert expression is None.
Pseudocode:
a is None
-
If true, return
(). -
Otherwise, call
panic!with a message and the values of the expressions with their debug representations.
§Examples
use assertables::*;
let a: Option<i8> = Option::None;
assert_none!(a);
// This will panic
let a: Option<i8> = Option::Some(1);
assert_none!(a);
// assertion failed: `assert_none!(a)`
// https://docs.rs/assertables/…/assertables/macro.assert_none.html
// a label: `a`,
// a debug: `Some(1)`