aboutsummaryrefslogtreecommitdiffstats
path: root/googlemock/include/gmock
diff options
context:
space:
mode:
authormisterg <misterg@google.com>2018-12-11 11:35:25 -0500
committerGennadiy Civil <misterg@google.com>2018-12-11 11:36:30 -0500
commit6cbd3753dc195595689a0fbb99e7297128a2ed26 (patch)
treecd5027fad4874d8bd36f51053a7977b048404ce8 /googlemock/include/gmock
parent06bb8d4d6dcfd1a6111794467676500d955cb144 (diff)
downloadgoogletest-6cbd3753dc195595689a0fbb99e7297128a2ed26.tar.gz
googletest-6cbd3753dc195595689a0fbb99e7297128a2ed26.tar.bz2
googletest-6cbd3753dc195595689a0fbb99e7297128a2ed26.zip
Googletest export
rollback of 224929783 PiperOrigin-RevId: 225008559
Diffstat (limited to 'googlemock/include/gmock')
-rw-r--r--googlemock/include/gmock/gmock-matchers.h14
1 files changed, 2 insertions, 12 deletions
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<const T&> either, as that allows
// potentially unsafe downcasting of the matcher argument.
const Matcher<const T&> matcher = SafeMatcherCast<const T&>(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();
}