assertables

Macro assert_option_some_ne

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

Assert two expressions are Some(_) and their values are not 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(2);
assert_option_some_ne!(a, b);

// This will panic
let a: Option<i8> = Option::Some(1);
let b: Option<i8> = Option::Some(1);
assert_option_some_ne!(a, b);
// assertion failed: `assert_option_some_ne!(a, b)`
// https://docs.rs/assertables/8.18.0/assertables/macro.assert_option_some_ne.html
//  a label: `a`,
//  a debug: `Some(1)`,
//  b label: `b`,
//  b debug: `Some(1)`,
//  a inner: `1`,
//  b inner: `1`

§Module macros