Macro lib::assert_option_some_eq
source · macro_rules! assert_option_some_eq { ($a_option:expr, $b_option:expr $(,)?) => { ... }; ($a_option:expr, $b_option:expr, $($message:tt)+) => { ... }; }
Expand description
Assert a.is_some() and a.unwrap() are equal to another.
-
If true, return
(). -
Otherwise, call
panic!with a message and the values of the expressions with their debug representations.
§Examples
let a: Option<i8> = Option::Some(1);
let b: Option<i8> = Option::Some(1);
assert_option_some_eq!(a, b);
let a: Option<i8> = Option::Some(1);
let b: Option<i8> = Option::Some(2);
assert_option_some_eq!(a, b);
// assertion failed: `assert_option_some_eq!(a, b)`
// a label: `a`,
// a debug: `Some(1)`,
// b label: `b`,
// b debug: `Some(2)`,
// a: `1`,
// b: `2`