From 7fb047bca335375a47ee0c4cddf4ffd92ac02673 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Wed, 17 Feb 2021 04:48:06 -0500 Subject: [PATCH] Googletest export Explain how to wrap matchers. PiperOrigin-RevId: 357901293 --- docs/gmock_cheat_sheet.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/gmock_cheat_sheet.md b/docs/gmock_cheat_sheet.md index b05c8a57..c82d9cc0 100644 --- a/docs/gmock_cheat_sheet.md +++ b/docs/gmock_cheat_sheet.md @@ -477,6 +477,14 @@ which must be a permanent callback. being matched and the matcher parameters). 3. You can use `PrintToString(x)` to convert a value `x` of any type to a string. +4. You can use `ExplainMatchResult()` in a custom matcher to wrap another + matcher, for example: + + ```cpp + MATCHER_P(NestedPropertyMatches, matcher, "") { + return ExplainMatchResult(matcher, arg.nested().property(), result_listener); + } + ``` ## Actions {#ActionList}