aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/reference/matchers.md12
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/reference/matchers.md b/docs/reference/matchers.md
index 9fb1592..be96281 100644
--- a/docs/reference/matchers.md
+++ b/docs/reference/matchers.md
@@ -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);
+ }
+ ```