diff options
author | jgm@google.com <jgm@google.com@861a406c-534a-0410-8894-cb66d6ee9925> | 2012-03-09 17:12:39 +0000 |
---|---|---|
committer | jgm@google.com <jgm@google.com@861a406c-534a-0410-8894-cb66d6ee9925> | 2012-03-09 17:12:39 +0000 |
commit | 7a574c99ea1d474f8ec5f040deba54169120f063 (patch) | |
tree | dea331f222e639cfc37f481766bbc88ce20dc7cb /test/gtest-death-test_test.cc | |
parent | 62576d5b3fb1173e4ad1b7fbc98f9d58323dfc64 (diff) | |
download | googletest-7a574c99ea1d474f8ec5f040deba54169120f063.tar.gz |
Misc small updates to some debug death code, and to messages streaming to macros
git-svn-id: http://googletest.googlecode.com/svn/trunk@612 861a406c-534a-0410-8894-cb66d6ee9925
Diffstat (limited to 'test/gtest-death-test_test.cc')
-rw-r--r-- | test/gtest-death-test_test.cc | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/test/gtest-death-test_test.cc b/test/gtest-death-test_test.cc index 5a4a989..b389e73 100644 --- a/test/gtest-death-test_test.cc +++ b/test/gtest-death-test_test.cc @@ -618,8 +618,8 @@ TEST_F(TestForDeathTest, ReturnIsFailure) { "illegal return in test statement."); } -// Tests that EXPECT_DEBUG_DEATH works as expected, -// that is, in debug mode, it: +// Tests that EXPECT_DEBUG_DEATH works as expected, that is, you can stream a +// message to it, and in debug mode it: // 1. Asserts on death. // 2. Has no side effect. // @@ -628,8 +628,8 @@ TEST_F(TestForDeathTest, ReturnIsFailure) { TEST_F(TestForDeathTest, TestExpectDebugDeath) { int sideeffect = 0; - EXPECT_DEBUG_DEATH(DieInDebugElse12(&sideeffect), - "death.*DieInDebugElse12"); + EXPECT_DEBUG_DEATH(DieInDebugElse12(&sideeffect), "death.*DieInDebugElse12") + << "Must accept a streamed message"; # ifdef NDEBUG @@ -644,22 +644,18 @@ TEST_F(TestForDeathTest, TestExpectDebugDeath) { # endif } -// Tests that ASSERT_DEBUG_DEATH works as expected -// In debug mode: -// 1. Asserts on debug death. +// Tests that ASSERT_DEBUG_DEATH works as expected, that is, you can stream a +// message to it, and in debug mode it: +// 1. Asserts on death. // 2. Has no side effect. // -// In opt mode: -// 1. Has side effects and returns the expected value (12). +// And in opt mode, it: +// 1. Has side effects but does not assert. TEST_F(TestForDeathTest, TestAssertDebugDeath) { int sideeffect = 0; - ASSERT_DEBUG_DEATH({ // NOLINT - // Tests that the return value is 12 in opt mode. - EXPECT_EQ(12, DieInDebugElse12(&sideeffect)); - // Tests that the side effect occurred in opt mode. - EXPECT_EQ(12, sideeffect); - }, "death.*DieInDebugElse12"); + ASSERT_DEBUG_DEATH(DieInDebugElse12(&sideeffect), "death.*DieInDebugElse12") + << "Must accept a streamed message"; # ifdef NDEBUG @@ -730,7 +726,7 @@ static void TestExitMacros() { // Of all signals effects on the process exit code, only those of SIGABRT // are documented on Windows. // See http://msdn.microsoft.com/en-us/library/dwwzkt4c(VS.71).aspx. - EXPECT_EXIT(raise(SIGABRT), testing::ExitedWithCode(3), ""); + EXPECT_EXIT(raise(SIGABRT), testing::ExitedWithCode(3), "") << "b_ar"; # else @@ -739,14 +735,14 @@ static void TestExitMacros() { EXPECT_FATAL_FAILURE({ // NOLINT ASSERT_EXIT(_exit(0), testing::KilledBySignal(SIGSEGV), "") - << "This failure is expected, too."; + << "This failure is expected, too."; }, "This failure is expected, too."); # endif // GTEST_OS_WINDOWS EXPECT_NONFATAL_FAILURE({ // NOLINT EXPECT_EXIT(raise(SIGSEGV), testing::ExitedWithCode(0), "") - << "This failure is expected."; + << "This failure is expected."; }, "This failure is expected."); } |