Function xpct::be_some

source ·
pub fn be_some<'a, T>() -> Matcher<'a, Option<T>, T, Option<Infallible>>where
    T: Debug + 'a,
Expand description

Succeeds when the actual value is Some.

If this matcher succeeds, it unwraps the Some value. When negated, it behaves like be_none.

Examples

use xpct::{expect, be_some, equal};

let value = Some("foobar");

expect!(value)
    .to(be_some())
    .to(equal("foobar"));