From 0570e2d930a185bbc375be70d9ad96836b955a4f Mon Sep 17 00:00:00 2001 From: Tom Hughes <tomhughes@google.com> Date: Tue, 7 Feb 2023 10:37:15 -0800 Subject: Remove GTEST_USES_PCRE references Nothing defines GTEST_USES_PCRE anymore. It was only meant for internal use, so nothing public should be relying on it: https://github.com/google/googletest/issues/2735#issuecomment-644849438. Found when compiling with "-Wundef". Fixes #2735. PiperOrigin-RevId: 507823660 Change-Id: Ie19e576ff01dc3b16381338578ece92adccfc09b --- googlemock/test/gmock-spec-builders_test.cc | 13 ++----------- googletest/test/googletest-death-test-test.cc | 21 --------------------- 2 files changed, 2 insertions(+), 32 deletions(-) diff --git a/googlemock/test/gmock-spec-builders_test.cc b/googlemock/test/gmock-spec-builders_test.cc index 76c9ff7..487b6c3 100644 --- a/googlemock/test/gmock-spec-builders_test.cc +++ b/googlemock/test/gmock-spec-builders_test.cc @@ -1088,16 +1088,7 @@ TEST(UnexpectedCallTest, UnsatisfiedPrerequisites) { // Verifies that the failure message contains the two unsatisfied // pre-requisites but not the satisfied one. -#if GTEST_USES_PCRE - EXPECT_THAT( - r.message(), - ContainsRegex( - // PCRE has trouble using (.|\n) to match any character, but - // supports the (?s) prefix for using . to match any character. - "(?s)the following immediate pre-requisites are not satisfied:\n" - ".*: pre-requisite #0\n" - ".*: pre-requisite #1")); -#elif GTEST_USES_POSIX_RE +#if GTEST_USES_POSIX_RE EXPECT_THAT(r.message(), ContainsRegex( // POSIX RE doesn't understand the (?s) prefix, but has no @@ -1112,7 +1103,7 @@ TEST(UnexpectedCallTest, UnsatisfiedPrerequisites) { "the following immediate pre-requisites are not satisfied:")); EXPECT_THAT(r.message(), ContainsRegex(": pre-requisite #0")); EXPECT_THAT(r.message(), ContainsRegex(": pre-requisite #1")); -#endif // GTEST_USES_PCRE +#endif // GTEST_USES_POSIX_RE b.DoB(1); b.DoB(3); diff --git a/googletest/test/googletest-death-test-test.cc b/googletest/test/googletest-death-test-test.cc index 4737ff9..515b599 100644 --- a/googletest/test/googletest-death-test-test.cc +++ b/googletest/test/googletest-death-test-test.cc @@ -327,23 +327,6 @@ TEST_F(TestForDeathTest, SingleStatement) { #pragma GCC diagnostic pop #endif -#if GTEST_USES_PCRE - -void DieWithEmbeddedNul() { - fprintf(stderr, "Hello%cmy null world.\n", '\0'); - fflush(stderr); - _exit(1); -} - -// Tests that EXPECT_DEATH and ASSERT_DEATH work when the error -// message has a NUL character in it. -TEST_F(TestForDeathTest, EmbeddedNulInMessage) { - EXPECT_DEATH(DieWithEmbeddedNul(), "my null world"); - ASSERT_DEATH(DieWithEmbeddedNul(), "my null world"); -} - -#endif // GTEST_USES_PCRE - // Tests that death test macros expand to code which interacts well with switch // statements. TEST_F(TestForDeathTest, SwitchStatement) { @@ -521,16 +504,12 @@ TEST_F(TestForDeathTest, AcceptsAnythingConvertibleToRE) { const testing::internal::RE regex(regex_c_str); EXPECT_DEATH(GlobalFunction(), regex); -#if !GTEST_USES_PCRE - const ::std::string regex_std_str(regex_c_str); EXPECT_DEATH(GlobalFunction(), regex_std_str); // This one is tricky; a temporary pointer into another temporary. Reference // lifetime extension of the pointer is not sufficient. EXPECT_DEATH(GlobalFunction(), ::std::string(regex_c_str).c_str()); - -#endif // !GTEST_USES_PCRE } // Tests that a non-void function can be used in a death test. -- cgit v0.12