diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h index 43456c25..cc045648 100644 --- a/googlemock/include/gmock/gmock-matchers.h +++ b/googlemock/include/gmock/gmock-matchers.h @@ -4843,7 +4843,7 @@ ThrowsMessage(const MessageMatcher& messageMatcher) { // literals, e.g. ThrowsMessage("message"). return MakePolymorphicMatcher( internal::ExceptionMatcherImpl{ - Property("description", &std::exception::what, + Property("what", &std::exception::what, MatcherCast(messageMatcher))}); } template @@ -4854,7 +4854,7 @@ ThrowsMessageHasSubstr(const internal::StringLike& message) { "expected an std::exception-derived class"); return MakePolymorphicMatcher( internal::ExceptionMatcherImpl{ - Property("description", &std::exception::what, HasSubstr(message))}); + Property("what", &std::exception::what, HasSubstr(message))}); } #endif // GTEST_HAS_EXCEPTIONS diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc index db2e0430..dd61a539 100644 --- a/googlemock/test/gmock-matchers_test.cc +++ b/googlemock/test/gmock-matchers_test.cc @@ -8282,10 +8282,8 @@ TEST(ThrowsPredicateCompilesTest, StringLikeMessage) { std::string inner; // Note: explicit conversion. - explicit operator std::string() const { - return inner; - } -}; + explicit operator std::string() const { return inner; } + }; Matcher matcher = ThrowsMessageHasSubstr( SomeCustomString{"error message"});