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 bool operator()(
int exit_status)
const;
196 void operator=(
const ExitedWithCode& other);
198 const int exit_code_;
201 # if !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA
207 explicit KilledBySignal(
int signum);
208 bool operator()(
int exit_status)
const;
259 # define EXPECT_DEBUG_DEATH(statement, regex) \
260 GTEST_EXECUTE_STATEMENT_(statement, regex)
262 # define ASSERT_DEBUG_DEATH(statement, regex) \
263 GTEST_EXECUTE_STATEMENT_(statement, regex)
267 # define EXPECT_DEBUG_DEATH(statement, regex) \
268 EXPECT_DEATH(statement, regex)
270 # define ASSERT_DEBUG_DEATH(statement, regex) \
271 ASSERT_DEATH(statement, regex)
311 # define GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, terminator) \
312 GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
313 if (::testing::internal::AlwaysTrue()) { \
314 GTEST_LOG_(WARNING) \
315 << "Death tests are not supported on this platform.\n" \
316 << "Statement '" #statement "' cannot be verified."; \
317 } else if (::testing::internal::AlwaysFalse()) { \
318 ::testing::internal::RE::PartialMatch(".*", (regex)); \
319 GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
329 #if GTEST_HAS_DEATH_TEST
330 # define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
331 EXPECT_DEATH(statement, regex)
332 # define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
333 ASSERT_DEATH(statement, regex)
335 # define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
336 GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, )
337 # define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
338 GTEST_UNSUPPORTED_DEATH_TEST(statement, regex, return)
GTEST_DECLARE_string_(death_test_style)