pub fn map<'a, In, Out>(
func: impl FnOnce(In) -> Out + 'a
) -> Matcher<'a, In, Out>where
In: 'a,
Out: 'a,
Expand description
Infallibly map the input value by applying a function to it.
This does the same thing as Assertion::map
.
This matcher always succeeds, even when negated. Therefore negating it has no effect.
Examples
use std::convert::Infallible;
use xpct::{expect, map, equal};
fn do_stuff() -> Result<String, Infallible> {
Ok(String::from("foobar"))
}
expect!(do_stuff())
.to(map(Result::unwrap))
.to(equal("foobar"));