Macro googletest::matchers::any
source · macro_rules! any { ($($matcher: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")))?; // Fails
Using this macro is equivalent to using the
or
method:
verify_that!(10, gt(9).or(lt(8)))?; // Also passes
Assertion failure messages are not guaranteed to be identical, however.