diff options
author | billydonahue <billydonahue@google.com> | 2014-05-15 19:42:15 +0000 |
---|---|---|
committer | billydonahue <billydonahue@google.com> | 2014-05-15 19:42:15 +0000 |
commit | 8120f66c3249e253f03fdb48bee7e528bc038d31 (patch) | |
tree | c7d7f91871f2078acc77b8b41dd5dd8313765a24 /test/gtest-death-test_test.cc | |
parent | 5df87d70b64dd8080ab9e3f1b0250e74715e2a60 (diff) | |
download | googletest-8120f66c3249e253f03fdb48bee7e528bc038d31.tar.gz googletest-8120f66c3249e253f03fdb48bee7e528bc038d31.tar.bz2 googletest-8120f66c3249e253f03fdb48bee7e528bc038d31.zip |
Push upstream to SVN.
Diffstat (limited to 'test/gtest-death-test_test.cc')
-rw-r--r-- | test/gtest-death-test_test.cc | 70 |
1 files changed, 30 insertions, 40 deletions
diff --git a/test/gtest-death-test_test.cc b/test/gtest-death-test_test.cc index da0b84d3..b25bc229 100644 --- a/test/gtest-death-test_test.cc +++ b/test/gtest-death-test_test.cc @@ -326,12 +326,9 @@ TEST_F(TestForDeathTest, EmbeddedNulInMessage) { // Tests that death test macros expand to code which interacts well with switch // statements. TEST_F(TestForDeathTest, SwitchStatement) { -// Microsoft compiler usually complains about switch statements without -// case labels. We suppress that warning for this test. -# ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable: 4065) -# endif // _MSC_VER + // Microsoft compiler usually complains about switch statements without + // case labels. We suppress that warning for this test. + GTEST_DISABLE_MSC_WARNINGS_PUSH_(4065) switch (0) default: @@ -341,9 +338,7 @@ TEST_F(TestForDeathTest, SwitchStatement) { case 0: EXPECT_DEATH(_exit(1), "") << "exit in switch case"; -# ifdef _MSC_VER -# pragma warning(pop) -# endif // _MSC_VER + GTEST_DISABLE_MSC_WARNINGS_POP_() } // Tests that a static member function can be used in a "fast" style @@ -1304,7 +1299,27 @@ TEST(ConditionalDeathMacrosDeathTest, ExpectsDeathWhenDeathTestsAvailable) { EXPECT_FATAL_FAILURE(ASSERT_DEATH_IF_SUPPORTED(;, ""), ""); } -#else +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"); +} + +#else // !GTEST_HAS_DEATH_TEST follows using testing::internal::CaptureStderr; using testing::internal::GetCapturedStderr; @@ -1354,27 +1369,7 @@ TEST(ConditionalDeathMacrosTest, AssertDeatDoesNotReturnhIfUnsupported) { EXPECT_EQ(1, n); } -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"); -} - -#endif // GTEST_HAS_DEATH_TEST +#endif // !GTEST_HAS_DEATH_TEST // Tests that the death test macros expand to code which may or may not // be followed by operator<<, and that in either case the complete text @@ -1405,12 +1400,9 @@ TEST(ConditionalDeathMacrosSyntaxDeathTest, SingleStatement) { // Tests that conditional death test macros expand to code which interacts // well with switch statements. TEST(ConditionalDeathMacrosSyntaxDeathTest, SwitchStatement) { -// Microsoft compiler usually complains about switch statements without -// case labels. We suppress that warning for this test. -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable: 4065) -#endif // _MSC_VER + // Microsoft compiler usually complains about switch statements without + // case labels. We suppress that warning for this test. + GTEST_DISABLE_MSC_WARNINGS_PUSH_(4065) switch (0) default: @@ -1421,9 +1413,7 @@ TEST(ConditionalDeathMacrosSyntaxDeathTest, SwitchStatement) { case 0: EXPECT_DEATH_IF_SUPPORTED(_exit(1), "") << "exit in switch case"; -#ifdef _MSC_VER -# pragma warning(pop) -#endif // _MSC_VER + GTEST_DISABLE_MSC_WARNINGS_POP_() } // Tests that a test case whose name ends with "DeathTest" works fine |