From 726118846d2ad431e40f3c9690962eb2eaed813b Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Wed, 27 Jan 2021 14:22:59 -0800 Subject: [PATCH] Googletest export Document the fact that MatchAndExplain(T, MatchResultListener*) is supported. PiperOrigin-RevId: 354172275 --- docs/gmock_cook_book.md | 3 +++ googletest/include/gtest/gtest-matchers.h | 1 + 2 files changed, 4 insertions(+) diff --git a/docs/gmock_cook_book.md b/docs/gmock_cook_book.md index 208ca9a6..26a140eb 100644 --- a/docs/gmock_cook_book.md +++ b/docs/gmock_cook_book.md @@ -3618,6 +3618,9 @@ Expected: is divisible by 7 Actual: 23 (the remainder is 2) ``` +Tip: for convenience, `MatchAndExplain()` can take a `MatchResultListener*` +instead of `std::ostream*`. + ### Writing New Polymorphic Matchers Expanding what we learned above to *polymorphic* matchers is now just as simple diff --git a/googletest/include/gtest/gtest-matchers.h b/googletest/include/gtest/gtest-matchers.h index fd8d9c66..d9ccbbf1 100644 --- a/googletest/include/gtest/gtest-matchers.h +++ b/googletest/include/gtest/gtest-matchers.h @@ -67,6 +67,7 @@ namespace testing { // 1. a class FooMatcherMatcher that implements the matcher interface: // using is_gtest_matcher = void; // bool MatchAndExplain(const T&, std::ostream*); +// (MatchResultListener* can also be used instead of std::ostream*) // void DescribeTo(std::ostream*); // void DescribeNegationTo(std::ostream*); //