Function googletest::matchers::err

source ·
pub fn err<T: Debug, E: Debug>(
    inner: impl Matcher<ActualT = E>
) -> impl Matcher<ActualT = Result<T, E>>
Expand description

Matches a Result containing Err with a value matched by inner.

verify_that!(Err::<(), _>("Some error"), err(eq("Some error")))?;  // Passes
verify_that!(Ok::<_, &str>("A value"), err(eq("A value")))?;   // Fails
verify_that!(Err::<(), _>("Some error"), err(eq("Some other error")))?;   // Fails