From 6cbd3753dc195595689a0fbb99e7297128a2ed26 Mon Sep 17 00:00:00 2001 From: misterg Date: Tue, 11 Dec 2018 11:35:25 -0500 Subject: Googletest export rollback of 224929783 PiperOrigin-RevId: 225008559 --- googlemock/include/gmock/gmock-matchers.h | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'googlemock/include/gmock') diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h index 68278bea..b859f1aa 100644 --- a/googlemock/include/gmock/gmock-matchers.h +++ b/googlemock/include/gmock/gmock-matchers.h @@ -1296,24 +1296,14 @@ class PredicateFormatterFromMatcher { // We don't write MatcherCast either, as that allows // potentially unsafe downcasting of the matcher argument. const Matcher matcher = SafeMatcherCast(matcher_); - - // The expected path here is that the matcher should match (i.e. that most - // tests pass) so optimize for this case. - if (matcher.Matches(x)) { + StringMatchResultListener listener; + if (MatchPrintAndExplain(x, matcher, &listener)) return AssertionSuccess(); - } ::std::stringstream ss; ss << "Value of: " << value_text << "\n" << "Expected: "; matcher.DescribeTo(&ss); - - // Rerun the matcher to "PrintAndExain" the failure. - StringMatchResultListener listener; - if (MatchPrintAndExplain(x, matcher, &listener)) { - ss << "\n The matcher failed on the initial attempt; but passed when " - "rerun to generate the explanation."; - } ss << "\n Actual: " << listener.str(); return AssertionFailure() << ss.str(); } -- cgit v1.2.3