diff options
| author | Abseil Team <absl-team@google.com> | 2021-02-17 04:48:06 -0500 |
|---|---|---|
| committer | Derek Mauro <dmauro@google.com> | 2021-02-18 13:27:08 -0500 |
| commit | 7fb047bca335375a47ee0c4cddf4ffd92ac02673 (patch) | |
| tree | 6519cfbd6dee2093b7517c75f62d3c94b1f91586 | |
| parent | 58937787164c94d609af8a326a19cb3e3dfb630c (diff) | |
| download | googletest-7fb047bca335375a47ee0c4cddf4ffd92ac02673.tar.gz googletest-7fb047bca335375a47ee0c4cddf4ffd92ac02673.zip | |
Googletest export
Explain how to wrap matchers.
PiperOrigin-RevId: 357901293
| -rw-r--r-- | docs/gmock_cheat_sheet.md | 8 |
1 files changed, 8 insertions, 0 deletions
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} |

