diff options
author | misterg <misterg@google.com> | 2018-12-11 16:35:25 (GMT) |
---|---|---|
committer | Gennadiy Civil <misterg@google.com> | 2018-12-11 16:36:30 (GMT) |
commit | 6cbd3753dc195595689a0fbb99e7297128a2ed26 (patch) | |
tree | cd5027fad4874d8bd36f51053a7977b048404ce8 /googlemock/include | |
parent | 06bb8d4d6dcfd1a6111794467676500d955cb144 (diff) | |
download | googletest-6cbd3753dc195595689a0fbb99e7297128a2ed26.zip googletest-6cbd3753dc195595689a0fbb99e7297128a2ed26.tar.gz googletest-6cbd3753dc195595689a0fbb99e7297128a2ed26.tar.bz2 |
Googletest export
rollback of 224929783
PiperOrigin-RevId: 225008559
Diffstat (limited to 'googlemock/include')
-rw-r--r-- | googlemock/include/gmock/gmock-matchers.h | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h index 68278be..b859f1a 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(); } |