Add missing documentation piece
This commit is contained in:
parent
46734d9a66
commit
49d1201a7e
@ -4812,7 +4812,8 @@ class ExceptionMatcherImpl {
|
|||||||
//
|
//
|
||||||
// EXPECT_THAT(
|
// EXPECT_THAT(
|
||||||
// []() { throw std::runtime_error("message"); },
|
// []() { throw std::runtime_error("message"); },
|
||||||
// Throws
|
// Throws<std::runtime_error>(
|
||||||
|
// Property(&std::runtime_error::what, HasSubstr("message"))));
|
||||||
|
|
||||||
template <typename Err>
|
template <typename Err>
|
||||||
PolymorphicMatcher<internal::ExceptionMatcherImpl<Err>>
|
PolymorphicMatcher<internal::ExceptionMatcherImpl<Err>>
|
||||||
|
@ -8119,6 +8119,26 @@ TEST(MatcherPMacroTest, WorksOnMoveOnlyType) {
|
|||||||
|
|
||||||
#if GTEST_HAS_EXCEPTIONS
|
#if GTEST_HAS_EXCEPTIONS
|
||||||
|
|
||||||
|
// Test that examples from documentation compile
|
||||||
|
TEST(ThrowsTest, Examples) {
|
||||||
|
EXPECT_THAT(
|
||||||
|
[]() { throw std::runtime_error("message"); },
|
||||||
|
Throws<std::runtime_error>());
|
||||||
|
|
||||||
|
EXPECT_THAT(
|
||||||
|
[]() { throw std::runtime_error("message"); },
|
||||||
|
ThrowsMessage<std::runtime_error>(HasSubstr("message")));
|
||||||
|
|
||||||
|
EXPECT_THAT(
|
||||||
|
[]() { throw std::runtime_error("message"); },
|
||||||
|
ThrowsMessageHasSubstr<std::runtime_error>("message"));
|
||||||
|
|
||||||
|
EXPECT_THAT(
|
||||||
|
[]() { throw std::runtime_error("message"); },
|
||||||
|
Throws<std::runtime_error>(
|
||||||
|
Property(&std::runtime_error::what, HasSubstr("message"))));
|
||||||
|
}
|
||||||
|
|
||||||
TEST(ThrowsTest, Describe) {
|
TEST(ThrowsTest, Describe) {
|
||||||
Matcher<void (*)()> matcher = Throws<std::runtime_error>();
|
Matcher<void (*)()> matcher = Throws<std::runtime_error>();
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
|
Loading…
Reference in New Issue
Block a user