macro_rules! any {
($(,)?) => { ... };
($matcher:expr $(,)?) => { ... };
($head:expr, $head2:expr $(,)?) => { ... };
($head:expr, $head2:expr, $($tail:expr),+ $(,)?) => { ... };
}Expand description
Matches a value which at least one of the given matchers match.
Each argument is a Matcher which matches
against the actual value.
For example:
verify_that!("A string", any!(starts_with("A"), ends_with("string")))?; // Passes
verify_that!("A string", any!(starts_with("A"), starts_with("string")))?; // Passes
verify_that!("A string", any!(ends_with("A"), ends_with("string")))?; // Passes
verify_that!("A string", any!(starts_with("An"), ends_with("not a string")))?; // FailsUsing this macro is equivalent to using the
or method:
verify_that!(10, gt(9).or(lt(8)))?; // Also passesAssertion failure messages are not guaranteed to be identical, however.
If an inner matcher is eq(...), it can be omitted:
verify_that!(123, any![lt(1), 123, gt(1000)])