Skip to main content

some

Function some 

Source
pub fn some<T, M>(inner: M) -> impl Matcher<Option<T>>
where M: Matcher<T>,
Expand description

Matches a Some whose contained value satisfies inner.

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

fn main() -> TestResult {
    check!(Some(42)).satisfies(some(eq(42)))?;
    check!(None::<i32>).violates(some(eq(42)))?;
    Ok(())
}