summaryrefslogtreecommitdiffstats
path: root/googlemock/include
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2022-04-04 19:55:29 (GMT)
committerCopybara-Service <copybara-worker@google.com>2022-04-04 19:56:24 (GMT)
commit3ffa237f0ed258bf92b28ab00dce3ecda84efffe (patch)
tree0a912fe9ffd101438df6a3de6ad9e2d970236368 /googlemock/include
parent25dcdc7e8bfac8967f20fb2c0a628f5cf442188d (diff)
downloadgoogletest-3ffa237f0ed258bf92b28ab00dce3ecda84efffe.zip
googletest-3ffa237f0ed258bf92b28ab00dce3ecda84efffe.tar.gz
googletest-3ffa237f0ed258bf92b28ab00dce3ecda84efffe.tar.bz2
Use ResultOf()'s result_description when explaining match result.
PiperOrigin-RevId: 439389646 Change-Id: Ie34adcdd2b24378e85962efac53b7bb89ed93803
Diffstat (limited to 'googlemock/include')
-rw-r--r--googlemock/include/gmock/gmock-matchers.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h
index 9584586..9750d84 100644
--- a/googlemock/include/gmock/gmock-matchers.h
+++ b/googlemock/include/gmock/gmock-matchers.h
@@ -2258,7 +2258,11 @@ class ResultOfMatcher {
}
bool MatchAndExplain(T obj, MatchResultListener* listener) const override {
- *listener << "which is mapped by the given callable to ";
+ if (result_description_.empty()) {
+ *listener << "which is mapped by the given callable to ";
+ } else {
+ *listener << "whose " << result_description_ << " is ";
+ }
// Cannot pass the return value directly to MatchPrintAndExplain, which
// takes a non-const reference as argument.
// Also, specifying template argument explicitly is needed because T could