diff options
author | vladlosev <vladlosev@861a406c-534a-0410-8894-cb66d6ee9925> | 2011-10-28 16:19:04 +0000 |
---|---|---|
committer | vladlosev <vladlosev@861a406c-534a-0410-8894-cb66d6ee9925> | 2011-10-28 16:19:04 +0000 |
commit | 829402edcffe712ed4c79412ca020525cd8295ad (patch) | |
tree | 9724f34e4e4a728238047ca1bd974b3c030e1d8f /test | |
parent | 83fe024fb0fefcd7069d5d4c0611eca6bf66bd1f (diff) | |
download | googletest-829402edcffe712ed4c79412ca020525cd8295ad.tar.gz googletest-829402edcffe712ed4c79412ca020525cd8295ad.tar.bz2 googletest-829402edcffe712ed4c79412ca020525cd8295ad.zip |
Adds support for detection of running in death test child processes.
Diffstat (limited to 'test')
-rw-r--r-- | test/gtest-death-test_test.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/gtest-death-test_test.cc b/test/gtest-death-test_test.cc index 15f6719b..54f5a1a1 100644 --- a/test/gtest-death-test_test.cc +++ b/test/gtest-death-test_test.cc @@ -75,6 +75,7 @@ using testing::internal::DeathTestFactory; using testing::internal::FilePath; using testing::internal::GetLastErrnoDescription; using testing::internal::GetUnitTestImpl; +using testing::internal::InDeathTestChild; using testing::internal::ParseNaturalNumber; using testing::internal::String; @@ -1345,6 +1346,26 @@ TEST(ConditionalDeathMacrosSyntaxDeathTest, SwitchStatement) { #endif // _MSC_VER } +TEST(InDeathTestChildDeathTest, ReportsDeathTestCorrectlyInFastStyle) { + testing::GTEST_FLAG(death_test_style) = "fast"; + EXPECT_FALSE(InDeathTestChild()); + EXPECT_DEATH({ + fprintf(stderr, InDeathTestChild() ? "Inside" : "Outside"); + fflush(stderr); + _exit(1); + }, "Inside"); +} + +TEST(InDeathTestChildDeathTest, ReportsDeathTestCorrectlyInThreadSafeStyle) { + testing::GTEST_FLAG(death_test_style) = "threadsafe"; + EXPECT_FALSE(InDeathTestChild()); + EXPECT_DEATH({ + fprintf(stderr, InDeathTestChild() ? "Inside" : "Outside"); + fflush(stderr); + _exit(1); + }, "Inside"); +} + // Tests that a test case whose name ends with "DeathTest" works fine // on Windows. TEST(NotADeathTest, Test) { |