aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-02-06 00:47:20 +0000
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-02-06 00:47:20 +0000
commit37504994338c114247519331237831f88a9a7c40 (patch)
treea7c84a0c95dd0bb3af5e23cd4cce7dba4c4bc8f2 /src
parentad99ca14461f0e929d835d29518e11c05e8d41f0 (diff)
downloadgoogletest-37504994338c114247519331237831f88a9a7c40.tar.gz
googletest-37504994338c114247519331237831f88a9a7c40.tar.bz2
googletest-37504994338c114247519331237831f88a9a7c40.zip
Adds tests for EXPECT_FATAL_FAILURE and reduces the golden file bloat (by Zhanyong Wan). Fixes more warnings on Windows (by Vlad Losev).
Diffstat (limited to 'src')
-rw-r--r--src/gtest.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gtest.cc b/src/gtest.cc
index 26077673..8e8238a9 100644
--- a/src/gtest.cc
+++ b/src/gtest.cc
@@ -3771,6 +3771,22 @@ int GetFailedPartCount(const TestResult* result) {
return result->failed_part_count();
}
+// Used by the GTEST_HIDE_UNREACHABLE_CODE_ macro to suppress unreachable
+// code warnings.
+namespace {
+class ClassUniqueToAlwaysTrue {};
+}
+
+bool AlwaysTrue() {
+#if GTEST_HAS_EXCEPTIONS
+ // This condition is always false so AlwaysTrue() never actually throws,
+ // but it makes the compiler think that it may throw.
+ if (atoi("42") == 36) // NOLINT
+ throw ClassUniqueToAlwaysTrue();
+#endif // GTEST_HAS_EXCEPTIONS
+ return true;
+}
+
// Parses a string as a command line flag. The string should have
// the format "--flag=value". When def_optional is true, the "=value"
// part can be omitted.