Skip to main content

ok

Function ok 

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

Matches an Ok whose contained value satisfies inner.

use test_better_core::TestResult;
use test_better_matchers::{eq, check, ok};

fn main() -> TestResult {
    check!(Ok::<i32, &str>(42)).satisfies(ok(eq(42)))?;
    check!(Err::<i32, &str>("boom")).violates(ok(eq(42)))?;
    Ok(())
}