Skip to main content

err

Function err 

Source
pub fn err<T, E, M>(inner: M) -> impl Matcher<Result<T, E>>
where M: Matcher<E>, T: Debug,
Expand description

Matches an Err whose contained value satisfies inner.

use test_better_core::TestResult;
use test_better_matchers::{eq, err, expect};

fn main() -> TestResult {
    expect!(Err::<i32, &str>("boom")).to(err(eq("boom")))?;
    expect!(Ok::<i32, &str>(0)).to_not(err(eq("boom")))?;
    Ok(())
}