assertables

Macro assert_option_some_eq

source
macro_rules! assert_option_some_eq {
    ($a:expr, $b:expr $(,)?) => { ... };
    ($a:expr, $b:expr, $($message:tt)+) => { ... };
}
👎Deprecated: Please rename from assert_option_some_eq to assert_some_eq because more developers prefer the shorter name.
Expand description

Assert two expressions are Some(_) and their values are equal.

  • 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::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)`
// https://docs.rs/assertables/8.10.1/assertables/macro.assert_option_some_eq.html
//  a label: `a`,
//  a debug: `Some(1)`,
//  a inner: `1`,
//  b label: `b`,
//  b debug: `Some(2)`,
//  b inner: `2`

§Module macros