Function xpct::be_ok

source ·
pub fn be_ok<'a, T, E>() -> Matcher<'a, Result<T, E>, T, E>where
    T: Debug + 'a,
    E: Debug + 'a,
Expand description

Succeeds when the actual value is Ok.

If this matcher succeeds, it unwraps the Ok value. When negated, it behaves like be_err.

Examples

use std::io;
use xpct::{expect, equal, be_ok};

fn might_fail() -> io::Result<String> {
    Ok(String::from("foobar"))
}

expect!(might_fail())
    .to(be_ok())
    .to(equal("foobar"));