diff options
author | Chris Johnson <chrisjohnsonmail@gmail.com> | 2018-12-14 13:11:15 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-14 13:11:15 -0600 |
commit | 130e5aa86a7a71501cf8fa7cd6f507928f01bd79 (patch) | |
tree | 2bc11702641f6bcca31032b4c343238d7b9178f6 /googlemock/include | |
parent | fe14e3030737509c2b9f9adad80ff56f80e988a2 (diff) | |
parent | b5f5c596a9915106c1ac36a3f89db4e0e49c07d1 (diff) | |
download | googletest-130e5aa86a7a71501cf8fa7cd6f507928f01bd79.tar.gz googletest-130e5aa86a7a71501cf8fa7cd6f507928f01bd79.tar.bz2 googletest-130e5aa86a7a71501cf8fa7cd6f507928f01bd79.zip |
Merge pull request #2 from google/master
merge upstream/master into master
Diffstat (limited to 'googlemock/include')
5 files changed, 16 insertions, 6 deletions
diff --git a/googlemock/include/gmock/gmock-generated-actions.h b/googlemock/include/gmock/gmock-generated-actions.h index 1e06213e..fac491b7 100644 --- a/googlemock/include/gmock/gmock-generated-actions.h +++ b/googlemock/include/gmock/gmock-generated-actions.h @@ -661,7 +661,7 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6, // MORE INFORMATION: // // To learn more about using these macros, please search for 'ACTION' on -// https://github.com/abseil/googletest/blob/master/googlemock/docs/CookBook.md +// https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md // An internal macro needed for implementing ACTION*(). #define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\ diff --git a/googlemock/include/gmock/gmock-generated-actions.h.pump b/googlemock/include/gmock/gmock-generated-actions.h.pump index 4381d6b2..d38b1f92 100644 --- a/googlemock/include/gmock/gmock-generated-actions.h.pump +++ b/googlemock/include/gmock/gmock-generated-actions.h.pump @@ -289,7 +289,7 @@ $range j2 2..i // MORE INFORMATION: // // To learn more about using these macros, please search for 'ACTION' on -// https://github.com/abseil/googletest/blob/master/googlemock/docs/CookBook.md +// https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md $range i 0..n $range k 0..n-1 diff --git a/googlemock/include/gmock/gmock-generated-matchers.h b/googlemock/include/gmock/gmock-generated-matchers.h index b77b3f19..f9c927c1 100644 --- a/googlemock/include/gmock/gmock-generated-matchers.h +++ b/googlemock/include/gmock/gmock-generated-matchers.h @@ -261,7 +261,7 @@ // // To learn more about using these macros, please search for 'MATCHER' // on -// https://github.com/abseil/googletest/blob/master/googlemock/docs/CookBook.md +// https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md #define MATCHER(name, description)\ class name##Matcher {\ diff --git a/googlemock/include/gmock/gmock-generated-matchers.h.pump b/googlemock/include/gmock/gmock-generated-matchers.h.pump index 8be4869b..43a0c5fa 100644 --- a/googlemock/include/gmock/gmock-generated-matchers.h.pump +++ b/googlemock/include/gmock/gmock-generated-matchers.h.pump @@ -263,7 +263,7 @@ $$ }} This line fixes auto-indentation of the following code in Emacs. // // To learn more about using these macros, please search for 'MATCHER' // on -// https://github.com/abseil/googletest/blob/master/googlemock/docs/CookBook.md +// https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md $range i 0..n $for i diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h index b859f1aa..68278bea 100644 --- a/googlemock/include/gmock/gmock-matchers.h +++ b/googlemock/include/gmock/gmock-matchers.h @@ -1296,14 +1296,24 @@ 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_); - StringMatchResultListener listener; - if (MatchPrintAndExplain(x, matcher, &listener)) + + // 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)) { 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(); } |