Mention DescribeMatcher in matchers.md

PiperOrigin-RevId: 504591836
Change-Id: I48c93490d0c3b7c6bfaceceb1cef5eedeacfe6c6
This commit is contained in:
Abseil Team 2023-01-25 10:03:30 -08:00 committed by Copybara-Service
parent d1ad27e0a4
commit 643862d8ad

View File

@ -288,3 +288,15 @@ which must be a permanent callback.
return ExplainMatchResult(matcher, arg.nested().property(), result_listener);
}
```
5. You can use `DescribeMatcher<>` to describe another matcher. For example:
```cpp
MATCHER_P(XAndYThat, matcher,
"X that " + DescribeMatcher<int>(matcher, negation) +
(negation ? " or" : " and") + " Y that " +
DescribeMatcher<double>(matcher, negation)) {
return ExplainMatchResult(matcher, arg.x(), result_listener) &&
ExplainMatchResult(matcher, arg.y(), result_listener);
}
```