From 3aa538cbfcc65989721632d2a8d79539512ebdb7 Mon Sep 17 00:00:00 2001 From: Muhammad Hilman Beyri Date: Sun, 12 Jan 2020 16:53:09 -0500 Subject: [PATCH 1/2] fix unit test failure on NoShortCircuitOnFailure and DetectsFlakyShortCircuit when GTEST_HAS_RTTI is 1 --- googlemock/test/gmock-matchers_test.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc index e6e8c8f4..98b814ba 100644 --- a/googlemock/test/gmock-matchers_test.cc +++ b/googlemock/test/gmock-matchers_test.cc @@ -6885,7 +6885,7 @@ TEST_F(PredicateFormatterFromMatcherTest, NoShortCircuitOnFailure) { EXPECT_FALSE(result); // Implicit cast to bool. std::string expect = "Value of: dummy-name\nExpected: [DescribeTo]\n" - " Actual: 1, [MatchAndExplain]"; + " Actual: 1" + OfType(internal::GetTypeName()) + ", [MatchAndExplain]"; EXPECT_EQ(expect, result.message()); } @@ -6896,7 +6896,7 @@ TEST_F(PredicateFormatterFromMatcherTest, DetectsFlakyShortCircuit) { "Value of: dummy-name\nExpected: [DescribeTo]\n" " The matcher failed on the initial attempt; but passed when rerun to " "generate the explanation.\n" - " Actual: 2, [MatchAndExplain]"; + " Actual: 2" + OfType(internal::GetTypeName()) + ", [MatchAndExplain]"; EXPECT_EQ(expect, result.message()); } From c7137f0b8422cb4544a8adb2ebc1de0ea71cae55 Mon Sep 17 00:00:00 2001 From: Muhammad Hilman Beyri Date: Sun, 12 Jan 2020 21:29:54 -0500 Subject: [PATCH 2/2] Use IsReadableTypeName IsReadableTypeName in OfType function in gmock-matchers_test.cc --- googlemock/test/gmock-matchers_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc index 98b814ba..96ca8959 100644 --- a/googlemock/test/gmock-matchers_test.cc +++ b/googlemock/test/gmock-matchers_test.cc @@ -140,7 +140,7 @@ Matcher GreaterThan(int n) { std::string OfType(const std::string& type_name) { #if GTEST_HAS_RTTI - return " (of type " + type_name + ")"; + return IsReadableTypeName(type_name) ? " (of type " + type_name + ")" : ""; #else return ""; #endif