diff --git a/docs/reference/matchers.md b/docs/reference/matchers.md index 9fb15927..be962819 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(matcher, negation) + + (negation ? " or" : " and") + " Y that " + + DescribeMatcher(matcher, negation)) { + return ExplainMatchResult(matcher, arg.x(), result_listener) && + ExplainMatchResult(matcher, arg.y(), result_listener); + } + ```