Trait faux::matcher::InvocationMatcher[][src]

pub trait InvocationMatcher<Args> {
    fn matches(&self, args: &Args) -> Result<(), String>;
}
Expand description

Matcher for the invocation of a method.

Implementors provide an expectation for each method argument.

This trait is implemented for tuples of ArgMatcher of up to ten elements.

Examples

Simple

use faux::matcher::{self, InvocationMatcher};

let matcher = (matcher::eq(5), matcher::any());
assert!(matcher.matches(&(5, "hello")).is_ok());
assert!(matcher.matches(&(3, "hello")).is_err());

Single argument

use faux::matcher::{self, InvocationMatcher};

// note that single arg matchers are wrapped in a tuple
// don't forget the trailing comma to denote it is a tuple
let matcher = (matcher::eq(20),);
assert!(matcher.matches(&20).is_ok());

Required methods

Returns Ok(()) when all arguments match.

Returns Err(String) if any argument fails to match. The error should detail which arguments failed and why.

Implementations on Foreign Types

Always succeeds, as there are no arguments to match against.

Succeeds if the argument matches the ArgMatcher.

Succeeds if every argument matches its corresponding ArgMatcher.

Succeeds if every argument matches its corresponding ArgMatcher.

Succeeds if every argument matches its corresponding ArgMatcher.

Succeeds if every argument matches its corresponding ArgMatcher.

Succeeds if every argument matches its corresponding ArgMatcher.

Succeeds if every argument matches its corresponding ArgMatcher.

Succeeds if every argument matches its corresponding ArgMatcher.

Succeeds if every argument matches its corresponding ArgMatcher.

Succeeds if every argument matches its corresponding ArgMatcher.

Implementors