assert_success

Macro assert_success 

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

Assert a success method is true.

Pseudocode:
a.success() = true

  • If true, return true.

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

§Examples

use assertables::*;

#[derive(Debug)]
struct A;
impl A { fn success(&self) -> bool { true }}
let a = A{};
assert_success!(a);

// This will panic
#[derive(Debug)]
struct A;
impl A { fn success(&self) -> bool { false }}
let a = A{};
assert_success!(a);
// assertion failed: `assert_success!(a)`
// https://docs.rs/assertables/…/assertables/macro.assert_success.html
//  a label: `a`,
//  a debug: `A`

§Module macros