assertables

Macro assert_err_ne

source
macro_rules! assert_err_ne {
    ($a:expr, $b:expr $(,)?) => { ... };
    ($a:expr, $b:expr, $($message:tt)+) => { ... };
}
Expand description

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

Pseudocode:
(a ⇒ Err(a̅) ⇒ a̅) ≠ (b ⇒ Err(b̅) ⇒ b̅)

  • If true, return ().

  • Otherwise, call panic! with a message and the values of the expressions with their debug representations.

§Examples

use assertables::*;

let a: Result<i8, i8> = Err(1);
let b: Result<i8, i8> = Err(2);
assert_err_ne!(a, b);

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

§Module macros