38 #ifndef GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
39 #define GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
52 #if GTEST_HAS_DEATH_TEST
168 # define ASSERT_EXIT(statement, predicate, regex) \
169 GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_)
173 # define EXPECT_EXIT(statement, predicate, regex) \
174 GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_)
179 # define ASSERT_DEATH(statement, regex) \
180 ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
184 # define EXPECT_DEATH(statement, regex) \
185 EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
192 explicit ExitedWithCode(
int exit_code);
193 ExitedWithCode(
const ExitedWithCode&) =
default;
194 void operator=(
const ExitedWithCode& other) =
delete;
195 bool operator()(
int exit_status)
const;
197 const int exit_code_;
200 # if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA
206 explicit KilledBySignal(
int signum);
207 bool operator()(
int exit_status)
const;
211 # endif // !GTEST_OS_WINDOWS
258 # define EXPECT_DEBUG_DEATH(statement, regex) \
259 GTEST_EXECUTE_STATEMENT_(statement, regex)
261 # define ASSERT_DEBUG_DEATH(statement, regex) \
262 GTEST_EXECUTE_STATEMENT_(statement, regex)
266 # define EXPECT_DEBUG_DEATH(statement, regex) \
267 EXPECT_DEATH(statement, regex)
269 # define ASSERT_DEBUG_DEATH(statement, regex) \
270 ASSERT_DEATH(statement, regex)
272 # endif // NDEBUG for EXPECT_DEBUG_DEATH
273 #endif // GTEST_HAS_DEATH_TEST
310 # define GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, terminator) \
311 GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
312 if (::testing::internal::AlwaysTrue()) { \
313 GTEST_LOG_(WARNING) \
314 << "Death tests are not supported on this platform.\n" \
315 << "Statement '" #statement "' cannot be verified."; \
316 } else if (::testing::internal::AlwaysFalse()) { \
317 ::testing::internal::RE::PartialMatch(".*", (regex)); \
318 GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
328 #if GTEST_HAS_DEATH_TEST
329 # define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
330 EXPECT_DEATH(statement, regex)
331 # define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
332 ASSERT_DEATH(statement, regex)
334 # define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
335 GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, )
336 # define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
337 GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, return)
342 #endif // GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_
GTEST_DECLARE_string_(death_test_style)