Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
googletest
Commits
49d1201a
Commit
49d1201a
authored
Jul 03, 2020
by
Vladimir Goncharov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing documentation piece
parent
46734d9a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
gmock-matchers.h
googlemock/include/gmock/gmock-matchers.h
+2
-1
gmock-matchers_test.cc
googlemock/test/gmock-matchers_test.cc
+20
-0
No files found.
googlemock/include/gmock/gmock-matchers.h
View file @
49d1201a
...
@@ -4812,7 +4812,8 @@ class ExceptionMatcherImpl {
...
@@ -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
>>
...
...
googlemock/test/gmock-matchers_test.cc
View file @
49d1201a
...
@@ -8119,6 +8119,26 @@ TEST(MatcherPMacroTest, WorksOnMoveOnlyType) {
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment