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, expect, some};

fn main() -> TestResult {
    expect!(Some(42)).to(some(eq(42)))?;
    expect!(None::<i32>).to_not(some(eq(42)))?;
    Ok(())
}