33 #include "gtest/gtest-death-test.h"
34 #include "gtest/gtest.h"
36 #if GTEST_HAS_DEATH_TEST
42 # include "gtest/gtest-spi.h"
44 # if GTEST_HAS_EXCEPTIONS
50 TEST(CxxExceptionDeathTest, ExceptionIsFailure) {
54 FAIL() <<
"An exception escaped a death test macro invocation "
55 <<
"with catch_exceptions "
60 class TestException :
public std::exception {
62 const char* what()
const noexcept
override {
return "exceptional message"; }
65 TEST(CxxExceptionDeathTest, PrintsMessageForStdExceptions) {
68 "exceptional message");
73 # endif // GTEST_HAS_EXCEPTIONS
79 TEST(SehExceptionDeasTest, CatchExceptionsDoesNotInterfere) {
80 EXPECT_DEATH(RaiseException(42, 0x0, 0, NULL),
"")
81 <<
"with catch_exceptions "
86 #endif // GTEST_HAS_DEATH_TEST
88 int main(
int argc,
char** argv) {
90 GTEST_FLAG_SET(catch_exceptions, GTEST_ENABLE_CATCH_EXCEPTIONS_ != 0);