Small improvements: code style and property name
This commit is contained in:
parent
9ac4cd0f49
commit
46734d9a66
@ -4843,7 +4843,7 @@ ThrowsMessage(const MessageMatcher& messageMatcher) {
|
|||||||
// literals, e.g. ThrowsMessage("message").
|
// literals, e.g. ThrowsMessage("message").
|
||||||
return MakePolymorphicMatcher(
|
return MakePolymorphicMatcher(
|
||||||
internal::ExceptionMatcherImpl<Err>{
|
internal::ExceptionMatcherImpl<Err>{
|
||||||
Property("description", &std::exception::what,
|
Property("what", &std::exception::what,
|
||||||
MatcherCast<std::string>(messageMatcher))});
|
MatcherCast<std::string>(messageMatcher))});
|
||||||
}
|
}
|
||||||
template <typename Err, typename Message = std::string>
|
template <typename Err, typename Message = std::string>
|
||||||
@ -4854,7 +4854,7 @@ ThrowsMessageHasSubstr(const internal::StringLike<Message>& message) {
|
|||||||
"expected an std::exception-derived class");
|
"expected an std::exception-derived class");
|
||||||
return MakePolymorphicMatcher(
|
return MakePolymorphicMatcher(
|
||||||
internal::ExceptionMatcherImpl<Err>{
|
internal::ExceptionMatcherImpl<Err>{
|
||||||
Property("description", &std::exception::what, HasSubstr(message))});
|
Property("what", &std::exception::what, HasSubstr(message))});
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // GTEST_HAS_EXCEPTIONS
|
#endif // GTEST_HAS_EXCEPTIONS
|
||||||
|
@ -8282,9 +8282,7 @@ TEST(ThrowsPredicateCompilesTest, StringLikeMessage) {
|
|||||||
std::string inner;
|
std::string inner;
|
||||||
|
|
||||||
// Note: explicit conversion.
|
// Note: explicit conversion.
|
||||||
explicit operator std::string() const {
|
explicit operator std::string() const { return inner; }
|
||||||
return inner;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Matcher<void (*)()> matcher = ThrowsMessageHasSubstr<std::runtime_error>(
|
Matcher<void (*)()> matcher = ThrowsMessageHasSubstr<std::runtime_error>(
|
||||||
|
Loading…
Reference in New Issue
Block a user