aboutsummaryrefslogtreecommitdiffstats
path: root/googletest/test
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2019-04-01 12:06:49 -0400
committerGennadiy Civil <misterg@google.com>2019-04-01 15:05:10 -0400
commitd9825431313a8ce466489cfc19f93820aee319ee (patch)
tree1e990b270e58ee75ca914c08eb7e0bcbb711737d /googletest/test
parent5b752b1947bbb4df571848a1afad00f9b06f30e0 (diff)
downloadgoogletest-d9825431313a8ce466489cfc19f93820aee319ee.tar.gz
googletest-d9825431313a8ce466489cfc19f93820aee319ee.tar.bz2
googletest-d9825431313a8ce466489cfc19f93820aee319ee.zip
Googletest export
Remove support for "global" ::string and ::wstring types. This support existed for legacy codebases that existed from before namespaces where a thing. It is no longer necessary. PiperOrigin-RevId: 241335738
Diffstat (limited to 'googletest/test')
-rw-r--r--googletest/test/googletest-death-test-test.cc11
-rw-r--r--googletest/test/googletest-port-test.cc7
-rw-r--r--googletest/test/googletest-printers-test.cc73
-rw-r--r--googletest/test/gtest_unittest.cc79
4 files changed, 2 insertions, 168 deletions
diff --git a/googletest/test/googletest-death-test-test.cc b/googletest/test/googletest-death-test-test.cc
index 01837ea7..b8645414 100644
--- a/googletest/test/googletest-death-test-test.cc
+++ b/googletest/test/googletest-death-test-test.cc
@@ -493,17 +493,6 @@ TEST_F(TestForDeathTest, AcceptsAnythingConvertibleToRE) {
const testing::internal::RE regex(regex_c_str);
EXPECT_DEATH(GlobalFunction(), regex);
-# if GTEST_HAS_GLOBAL_STRING
-
- const ::string regex_str(regex_c_str);
- EXPECT_DEATH(GlobalFunction(), regex_str);
-
- // This one is tricky; a temporary pointer into another temporary. Reference
- // lifetime extension of the pointer is not sufficient.
- EXPECT_DEATH(GlobalFunction(), ::string(regex_c_str).c_str());
-
-# endif // GTEST_HAS_GLOBAL_STRING
-
# if !GTEST_USES_PCRE
const ::std::string regex_std_str(regex_c_str);
diff --git a/googletest/test/googletest-port-test.cc b/googletest/test/googletest-port-test.cc
index 39b643b6..6cb791e5 100644
--- a/googletest/test/googletest-port-test.cc
+++ b/googletest/test/googletest-port-test.cc
@@ -388,12 +388,7 @@ class RETest : public ::testing::Test {};
// Defines StringTypes as the list of all string types that class RE
// supports.
-typedef testing::Types<
- ::std::string,
-# if GTEST_HAS_GLOBAL_STRING
- ::string,
-# endif // GTEST_HAS_GLOBAL_STRING
- const char*> StringTypes;
+typedef testing::Types< ::std::string, const char*> StringTypes;
TYPED_TEST_SUITE(RETest, StringTypes);
diff --git a/googletest/test/googletest-printers-test.cc b/googletest/test/googletest-printers-test.cc
index 5ce2a770..d896c241 100644
--- a/googletest/test/googletest-printers-test.cc
+++ b/googletest/test/googletest-printers-test.cc
@@ -656,16 +656,6 @@ TEST(PrintArrayTest, BigArray) {
// Tests printing ::string and ::std::string.
-#if GTEST_HAS_GLOBAL_STRING
-// ::string.
-TEST(PrintStringTest, StringInGlobalNamespace) {
- const char s[] = "'\"?\\\a\b\f\n\0\r\t\v\x7F\xFF a";
- const ::string str(s, sizeof(s));
- EXPECT_EQ("\"'\\\"?\\\\\\a\\b\\f\\n\\0\\r\\t\\v\\x7F\\xFF a\\0\"",
- Print(str));
-}
-#endif // GTEST_HAS_GLOBAL_STRING
-
// ::std::string.
TEST(PrintStringTest, StringInStdNamespace) {
const char s[] = "'\"?\\\a\b\f\n\0\r\t\v\x7F\xFF a";
@@ -688,19 +678,7 @@ TEST(PrintStringTest, StringAmbiguousHex) {
EXPECT_EQ("\"!\\x5-!\"", Print(::std::string("!\x5-!")));
}
-// Tests printing ::wstring and ::std::wstring.
-
-#if GTEST_HAS_GLOBAL_WSTRING
-// ::wstring.
-TEST(PrintWideStringTest, StringInGlobalNamespace) {
- const wchar_t s[] = L"'\"?\\\a\b\f\n\0\r\t\v\xD3\x576\x8D3\xC74D a";
- const ::wstring str(s, sizeof(s)/sizeof(wchar_t));
- EXPECT_EQ("L\"'\\\"?\\\\\\a\\b\\f\\n\\0\\r\\t\\v"
- "\\xD3\\x576\\x8D3\\xC74D a\\0\"",
- Print(str));
-}
-#endif // GTEST_HAS_GLOBAL_WSTRING
-
+// Tests printing ::std::wstring.
#if GTEST_HAS_STD_WSTRING
// ::std::wstring.
TEST(PrintWideStringTest, StringInStdNamespace) {
@@ -1243,21 +1221,6 @@ TEST(FormatForComparisonFailureMessageTest, WorksForWCharPointerVsPointer) {
// Tests formatting a char pointer when it's compared to a string object.
// In this case we want to print the char pointer as a C string.
-#if GTEST_HAS_GLOBAL_STRING
-// char pointer vs ::string
-TEST(FormatForComparisonFailureMessageTest, WorksForCharPointerVsString) {
- const char* s = "hello \"world";
- EXPECT_STREQ("\"hello \\\"world\"", // The string content should be escaped.
- FormatForComparisonFailureMessage(s, ::string()).c_str());
-
- // char*
- char str[] = "hi\1";
- char* p = str;
- EXPECT_STREQ("\"hi\\x1\"", // The string content should be escaped.
- FormatForComparisonFailureMessage(p, ::string()).c_str());
-}
-#endif
-
// char pointer vs std::string
TEST(FormatForComparisonFailureMessageTest, WorksForCharPointerVsStdString) {
const char* s = "hello \"world";
@@ -1271,21 +1234,6 @@ TEST(FormatForComparisonFailureMessageTest, WorksForCharPointerVsStdString) {
FormatForComparisonFailureMessage(p, ::std::string()).c_str());
}
-#if GTEST_HAS_GLOBAL_WSTRING
-// wchar_t pointer vs ::wstring
-TEST(FormatForComparisonFailureMessageTest, WorksForWCharPointerVsWString) {
- const wchar_t* s = L"hi \"world";
- EXPECT_STREQ("L\"hi \\\"world\"", // The string content should be escaped.
- FormatForComparisonFailureMessage(s, ::wstring()).c_str());
-
- // wchar_t*
- wchar_t str[] = L"hi\1";
- wchar_t* p = str;
- EXPECT_STREQ("L\"hi\\x1\"", // The string content should be escaped.
- FormatForComparisonFailureMessage(p, ::wstring()).c_str());
-}
-#endif
-
#if GTEST_HAS_STD_WSTRING
// wchar_t pointer vs std::wstring
TEST(FormatForComparisonFailureMessageTest, WorksForWCharPointerVsStdWString) {
@@ -1338,16 +1286,6 @@ TEST(FormatForComparisonFailureMessageTest, WorksForWCharArrayVsWCharArray) {
// Tests formatting a char array when it's compared with a string object.
// In this case we want to print the array as a C string.
-#if GTEST_HAS_GLOBAL_STRING
-// char array vs string
-TEST(FormatForComparisonFailureMessageTest, WorksForCharArrayVsString) {
- const char str[] = "hi \"w\0rld\"";
- EXPECT_STREQ("\"hi \\\"w\"", // The content should be escaped.
- // Embedded NUL terminates the string.
- FormatForComparisonFailureMessage(str, ::string()).c_str());
-}
-#endif
-
// char array vs std::string
TEST(FormatForComparisonFailureMessageTest, WorksForCharArrayVsStdString) {
const char str[] = "hi \"world\"";
@@ -1355,15 +1293,6 @@ TEST(FormatForComparisonFailureMessageTest, WorksForCharArrayVsStdString) {
FormatForComparisonFailureMessage(str, ::std::string()).c_str());
}
-#if GTEST_HAS_GLOBAL_WSTRING
-// wchar_t array vs wstring
-TEST(FormatForComparisonFailureMessageTest, WorksForWCharArrayVsWString) {
- const wchar_t str[] = L"hi \"world\"";
- EXPECT_STREQ("L\"hi \\\"world\\\"\"", // The content should be escaped.
- FormatForComparisonFailureMessage(str, ::wstring()).c_str());
-}
-#endif
-
#if GTEST_HAS_STD_WSTRING
// wchar_t array vs std::wstring
TEST(FormatForComparisonFailureMessageTest, WorksForWCharArrayVsStdWString) {
diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc
index 4e67120b..9c1827d4 100644
--- a/googletest/test/gtest_unittest.cc
+++ b/googletest/test/gtest_unittest.cc
@@ -1243,12 +1243,6 @@ TEST_F(ExpectFatalFailureTest, CatchesFatalFaliure) {
EXPECT_FATAL_FAILURE(AddFatalFailure(), "Expected fatal failure.");
}
-#if GTEST_HAS_GLOBAL_STRING
-TEST_F(ExpectFatalFailureTest, AcceptsStringObject) {
- EXPECT_FATAL_FAILURE(AddFatalFailure(), ::string("Expected fatal failure."));
-}
-#endif
-
TEST_F(ExpectFatalFailureTest, AcceptsStdStringObject) {
EXPECT_FATAL_FAILURE(AddFatalFailure(),
::std::string("Expected fatal failure."));
@@ -1331,13 +1325,6 @@ TEST_F(ExpectNonfatalFailureTest, CatchesNonfatalFailure) {
"Expected non-fatal failure.");
}
-#if GTEST_HAS_GLOBAL_STRING
-TEST_F(ExpectNonfatalFailureTest, AcceptsStringObject) {
- EXPECT_NONFATAL_FAILURE(AddNonfatalFailure(),
- ::string("Expected non-fatal failure."));
-}
-#endif
-
TEST_F(ExpectNonfatalFailureTest, AcceptsStdStringObject) {
EXPECT_NONFATAL_FAILURE(AddNonfatalFailure(),
::std::string("Expected non-fatal failure."));
@@ -4852,72 +4839,6 @@ TEST(EqAssertionTest, StdWideString) {
#endif // GTEST_HAS_STD_WSTRING
-#if GTEST_HAS_GLOBAL_STRING
-// Tests using ::string values in {EXPECT|ASSERT}_EQ.
-TEST(EqAssertionTest, GlobalString) {
- // Compares a const char* to a ::string that has identical content.
- EXPECT_EQ("Test", ::string("Test"));
-
- // Compares two identical ::strings.
- const ::string str1("A * in the middle");
- const ::string str2(str1);
- ASSERT_EQ(str1, str2);
-
- // Compares a ::string to a const char* that has different content.
- EXPECT_NONFATAL_FAILURE(EXPECT_EQ(::string("Test"), "test"),
- "test");
-
- // Compares two ::strings that have different contents, one of which
- // having a NUL character in the middle.
- ::string str3(str1);
- str3.at(2) = '\0';
- EXPECT_NONFATAL_FAILURE(EXPECT_EQ(str1, str3),
- "str3");
-
- // Compares a ::string to a char* that has different content.
- EXPECT_FATAL_FAILURE({ // NOLINT
- ASSERT_EQ(::string("bar"), const_cast<char*>("foo"));
- }, "");
-}
-
-#endif // GTEST_HAS_GLOBAL_STRING
-
-#if GTEST_HAS_GLOBAL_WSTRING
-
-// Tests using ::wstring values in {EXPECT|ASSERT}_EQ.
-TEST(EqAssertionTest, GlobalWideString) {
- // Compares two identical ::wstrings.
- static const ::wstring wstr1(L"A * in the middle");
- static const ::wstring wstr2(wstr1);
- EXPECT_EQ(wstr1, wstr2);
-
- // Compares a const wchar_t* to a ::wstring that has identical content.
- const wchar_t kTestX8119[] = { 'T', 'e', 's', 't', 0x8119, '\0' };
- ASSERT_EQ(kTestX8119, ::wstring(kTestX8119));
-
- // Compares a const wchar_t* to a ::wstring that has different
- // content.
- const wchar_t kTestX8120[] = { 'T', 'e', 's', 't', 0x8120, '\0' };
- EXPECT_NONFATAL_FAILURE({ // NOLINT
- EXPECT_EQ(kTestX8120, ::wstring(kTestX8119));
- }, "Test\\x8119");
-
- // Compares a wchar_t* to a ::wstring that has different content.
- wchar_t* const p1 = const_cast<wchar_t*>(L"foo");
- EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p1, ::wstring(L"bar")),
- "bar");
-
- // Compares two ::wstrings that have different contents, one of which
- // having a NUL character in the middle.
- static ::wstring wstr3;
- wstr3 = wstr1;
- wstr3.at(2) = L'\0';
- EXPECT_FATAL_FAILURE(ASSERT_EQ(wstr1, wstr3),
- "wstr3");
-}
-
-#endif // GTEST_HAS_GLOBAL_WSTRING
-
// Tests using char pointers in {EXPECT|ASSERT}_EQ.
TEST(EqAssertionTest, CharPointer) {
char* const p0 = nullptr;