pub fn be_err<'a, T, E>() -> Matcher<'a, Result<T, E>, E, T>where
T: Debug + 'a,
E: Debug + 'a,
Expand description
Succeeds when the actual value is Err
.
If this matcher succeeds, it unwraps the Err
value. When negated, it behaves like
be_ok
.
Examples
use std::io;
use xpct::{expect, equal, be_err};
fn might_fail() -> io::Result<()> {
Err(io::Error::new(io::ErrorKind::Other, "something bad happened"))
}
expect!(might_fail())
.to(be_err())
.map(|err| err.kind())
.to(equal(io::ErrorKind::Other));