aboutsummaryrefslogtreecommitdiffstats
path: root/include/gtest/gtest-death-test.h
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-08-07 06:47:47 +0000
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-08-07 06:47:47 +0000
commited8500b341c473ecf46acd13951ae5b4e3acc780 (patch)
treeca41796e67c988e8985cc084e1c6136aa609df39 /include/gtest/gtest-death-test.h
parent18c31d64e120919e8e04df3035234b9afe8eb6d9 (diff)
downloadgoogletest-ed8500b341c473ecf46acd13951ae5b4e3acc780.tar.gz
googletest-ed8500b341c473ecf46acd13951ae5b4e3acc780.tar.bz2
googletest-ed8500b341c473ecf46acd13951ae5b4e3acc780.zip
Implements EXPECT_DEATH_IF_SUPPORTED (by Vlad Losev); Fixes compatibility with Symbian (by Araceli Checa); Removes GetCapturedStderr()'s dependency on std::string (by Vlad Losev).
Diffstat (limited to 'include/gtest/gtest-death-test.h')
-rw-r--r--include/gtest/gtest-death-test.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/gtest/gtest-death-test.h b/include/gtest/gtest-death-test.h
index dcb2b66e..410654b9 100644
--- a/include/gtest/gtest-death-test.h
+++ b/include/gtest/gtest-death-test.h
@@ -257,6 +257,28 @@ class KilledBySignal {
#endif // NDEBUG for EXPECT_DEBUG_DEATH
#endif // GTEST_HAS_DEATH_TEST
+
+// EXPECT_DEATH_IF_SUPPORTED(statement, regex) and
+// ASSERT_DEATH_IF_SUPPORTED(statement, regex) expand to real death tests if
+// death tests are supported; otherwise they expand to empty. This is
+// useful when you are combining death test assertions with normal test
+// assertions in one test.
+#if GTEST_HAS_DEATH_TEST
+#define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
+ EXPECT_DEATH(statement, regex)
+#define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
+ ASSERT_DEATH(statement, regex)
+#else
+#define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
+ GTEST_LOG_(WARNING, \
+ "Death tests are not supported on this platform. The statement" \
+ " '" #statement "' can not be verified")
+#define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
+ GTEST_LOG_(WARNING, \
+ "Death tests are not supported on this platform. The statement" \
+ " '" #statement "' can not be verified")
+#endif
+
} // namespace testing
#endif // GTEST_INCLUDE_GTEST_GTEST_DEATH_TEST_H_