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
df157130
Commit
df157130
authored
May 06, 2021
by
durandal
Committed by
CJ Johnson
May 13, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Googletest export
Add a note documenting that death test macros accept arbitrary gmock matchers against child-process stderr, not just regexes. PiperOrigin-RevId: 372365998
parent
f381758e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
15 deletions
+19
-15
gtest-death-test.h
googletest/include/gtest/gtest-death-test.h
+19
-15
No files found.
googletest/include/gtest/gtest-death-test.h
View file @
df157130
...
@@ -97,6 +97,10 @@ GTEST_API_ bool InDeathTestChild();
...
@@ -97,6 +97,10 @@ GTEST_API_ bool InDeathTestChild();
//
//
// ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!");
// ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!");
//
//
// The final parameter to each of these macros is a matcher applied to any data
// the sub-process wrote to stderr. For compatibility with existing tests, a
// bare string is interpreted as a regular expression matcher.
//
// On the regular expressions used in death tests:
// On the regular expressions used in death tests:
//
//
// GOOGLETEST_CM0005 DO NOT DELETE
// GOOGLETEST_CM0005 DO NOT DELETE
...
@@ -162,27 +166,27 @@ GTEST_API_ bool InDeathTestChild();
...
@@ -162,27 +166,27 @@ GTEST_API_ bool InDeathTestChild();
// directory in PATH.
// directory in PATH.
//
//
// Asserts that a given
statement
causes the program to exit, with an
// Asserts that a given
`statement`
causes the program to exit, with an
// integer exit status that satisfies
predicate
, and emitting error output
// integer exit status that satisfies
`predicate`
, and emitting error output
// that matches
regex
.
// that matches
`matcher`
.
# define ASSERT_EXIT(statement, predicate,
regex
) \
# define ASSERT_EXIT(statement, predicate,
matcher
) \
GTEST_DEATH_TEST_(statement, predicate,
regex
, GTEST_FATAL_FAILURE_)
GTEST_DEATH_TEST_(statement, predicate,
matcher
, GTEST_FATAL_FAILURE_)
// Like
ASSERT_EXIT
, but continues on to successive tests in the
// Like
`ASSERT_EXIT`
, but continues on to successive tests in the
// test suite, if any:
// test suite, if any:
# define EXPECT_EXIT(statement, predicate,
regex
) \
# define EXPECT_EXIT(statement, predicate,
matcher
) \
GTEST_DEATH_TEST_(statement, predicate,
regex
, GTEST_NONFATAL_FAILURE_)
GTEST_DEATH_TEST_(statement, predicate,
matcher
, GTEST_NONFATAL_FAILURE_)
// Asserts that a given
statement
causes the program to exit, either by
// Asserts that a given
`statement`
causes the program to exit, either by
// explicitly exiting with a nonzero exit code or being killed by a
// explicitly exiting with a nonzero exit code or being killed by a
// signal, and emitting error output that matches
regex
.
// signal, and emitting error output that matches
`matcher`
.
# define ASSERT_DEATH(statement,
regex
) \
# define ASSERT_DEATH(statement,
matcher
) \
ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully,
regex
)
ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully,
matcher
)
// Like
ASSERT_DEATH
, but continues on to successive tests in the
// Like
`ASSERT_DEATH`
, but continues on to successive tests in the
// test suite, if any:
// test suite, if any:
# define EXPECT_DEATH(statement,
regex
) \
# define EXPECT_DEATH(statement,
matcher
) \
EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully,
regex
)
EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully,
matcher
)
// Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
// Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
...
...
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