diff options
Diffstat (limited to 'googletest/test/googletest-death-test-test.cc')
-rw-r--r-- | googletest/test/googletest-death-test-test.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/googletest/test/googletest-death-test-test.cc b/googletest/test/googletest-death-test-test.cc index b0dda27f..c0b3d1f2 100644 --- a/googletest/test/googletest-death-test-test.cc +++ b/googletest/test/googletest-death-test-test.cc @@ -298,6 +298,13 @@ TEST(ExitStatusPredicateTest, KilledBySignal) { # endif // GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA +// The following code intentionally tests a suboptimal syntax. +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdangling-else" +#pragma GCC diagnostic ignored "-Wempty-body" +#pragma GCC diagnostic ignored "-Wpragmas" +#endif // 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 // comprises only a single C++ statement. @@ -321,6 +328,9 @@ TEST_F(TestForDeathTest, SingleStatement) { else EXPECT_DEATH(_exit(1), "") << 1 << 2 << 3; } +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif # if GTEST_USES_PCRE @@ -1376,7 +1386,11 @@ void DieWithMessage(const char* message) { TEST(MatcherDeathTest, DoesNotBreakBareRegexMatching) { // googletest tests this, of course; here we ensure that including googlemock // has not broken it. +#if GTEST_USES_POSIX_RE EXPECT_DEATH(DieWithMessage("O, I die, Horatio."), "I d[aeiou]e"); +#else + EXPECT_DEATH(DieWithMessage("O, I die, Horatio."), "I di?e"); +#endif } TEST(MatcherDeathTest, MonomorphicMatcherMatches) { @@ -1464,6 +1478,13 @@ TEST(ConditionalDeathMacrosTest, AssertDeatDoesNotReturnhIfUnsupported) { namespace { +// The following code intentionally tests a suboptimal syntax. +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdangling-else" +#pragma GCC diagnostic ignored "-Wempty-body" +#pragma GCC diagnostic ignored "-Wpragmas" +#endif // 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 // comprises only a single C++ statement. @@ -1489,6 +1510,9 @@ TEST(ConditionalDeathMacrosSyntaxDeathTest, SingleStatement) { else EXPECT_DEATH_IF_SUPPORTED(_exit(1), "") << 1 << 2 << 3; } +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif // Tests that conditional death test macros expand to code which interacts // well with switch statements. |