@@ -97,6 +97,10 @@ GTEST_API_ bool InDeathTestChild();
97
97
//
98
98
// ASSERT_EXIT(client.HangUpServer(), KilledBySIGHUP, "Hanging up!");
99
99
//
100
+ // The final parameter to each of these macros is a matcher applied to any data
101
+ // the sub-process wrote to stderr. For compatibility with existing tests, a
102
+ // bare string is interpreted as a regular expression matcher.
103
+ //
100
104
// On the regular expressions used in death tests:
101
105
//
102
106
// GOOGLETEST_CM0005 DO NOT DELETE
@@ -162,27 +166,27 @@ GTEST_API_ bool InDeathTestChild();
162
166
// directory in PATH.
163
167
//
164
168
165
- // Asserts that a given statement causes the program to exit, with an
166
- // integer exit status that satisfies predicate, and emitting error output
167
- // that matches regex .
168
- # define ASSERT_EXIT (statement, predicate, regex ) \
169
- GTEST_DEATH_TEST_ (statement, predicate, regex , GTEST_FATAL_FAILURE_)
169
+ // Asserts that a given ` statement` causes the program to exit, with an
170
+ // integer exit status that satisfies ` predicate` , and emitting error output
171
+ // that matches `matcher` .
172
+ # define ASSERT_EXIT (statement, predicate, matcher ) \
173
+ GTEST_DEATH_TEST_ (statement, predicate, matcher , GTEST_FATAL_FAILURE_)
170
174
171
- // Like ASSERT_EXIT, but continues on to successive tests in the
175
+ // Like ` ASSERT_EXIT` , but continues on to successive tests in the
172
176
// test suite, if any:
173
- # define EXPECT_EXIT (statement, predicate, regex ) \
174
- GTEST_DEATH_TEST_ (statement, predicate, regex , GTEST_NONFATAL_FAILURE_)
177
+ # define EXPECT_EXIT (statement, predicate, matcher ) \
178
+ GTEST_DEATH_TEST_ (statement, predicate, matcher , GTEST_NONFATAL_FAILURE_)
175
179
176
- // Asserts that a given statement causes the program to exit, either by
180
+ // Asserts that a given ` statement` causes the program to exit, either by
177
181
// explicitly exiting with a nonzero exit code or being killed by a
178
- // signal, and emitting error output that matches regex .
179
- # define ASSERT_DEATH (statement, regex ) \
180
- ASSERT_EXIT (statement, ::testing::internal::ExitedUnsuccessfully, regex )
182
+ // signal, and emitting error output that matches `matcher` .
183
+ # define ASSERT_DEATH (statement, matcher ) \
184
+ ASSERT_EXIT (statement, ::testing::internal::ExitedUnsuccessfully, matcher )
181
185
182
- // Like ASSERT_DEATH, but continues on to successive tests in the
186
+ // Like ` ASSERT_DEATH` , but continues on to successive tests in the
183
187
// test suite, if any:
184
- # define EXPECT_DEATH (statement, regex ) \
185
- EXPECT_EXIT (statement, ::testing::internal::ExitedUnsuccessfully, regex )
188
+ # define EXPECT_DEATH (statement, matcher ) \
189
+ EXPECT_EXIT (statement, ::testing::internal::ExitedUnsuccessfully, matcher )
186
190
187
191
// Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
188
192
0 commit comments