about summary refs log tree commit diff
path: root/absl/strings/str_split_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/strings/str_split_test.cc')
-rw-r--r--absl/strings/str_split_test.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/absl/strings/str_split_test.cc b/absl/strings/str_split_test.cc
index 500f3cbc3789..b1db1c5647e7 100644
--- a/absl/strings/str_split_test.cc
+++ b/absl/strings/str_split_test.cc
@@ -621,23 +621,28 @@ TEST(Split, StringDelimiter) {
 
 TEST(Split, UTF8) {
   // Tests splitting utf8 strings and utf8 delimiters.
+  std::string utf8_string = "\u03BA\u1F79\u03C3\u03BC\u03B5";
   {
     // A utf8 input std::string with an ascii delimiter.
-    std::vector<absl::string_view> v = absl::StrSplit("a,κόσμε", ',');
-    EXPECT_THAT(v, ElementsAre("a", "κόσμε"));
+    std::string to_split = "a," + utf8_string;
+    std::vector<absl::string_view> v = absl::StrSplit(to_split, ',');
+    EXPECT_THAT(v, ElementsAre("a", utf8_string));
   }
 
   {
     // A utf8 input std::string and a utf8 delimiter.
-    std::vector<absl::string_view> v = absl::StrSplit("a,κόσμε,b", ",κόσμε,");
+    std::string to_split = "a," + utf8_string + ",b";
+    std::string unicode_delimiter = "," + utf8_string + ",";
+    std::vector<absl::string_view> v =
+        absl::StrSplit(to_split, unicode_delimiter);
     EXPECT_THAT(v, ElementsAre("a", "b"));
   }
 
   {
     // A utf8 input std::string and ByAnyChar with ascii chars.
     std::vector<absl::string_view> v =
-        absl::StrSplit("Foo hällo th丞re", absl::ByAnyChar(" \t"));
-    EXPECT_THAT(v, ElementsAre("Foo", "hällo", "th丞re"));
+        absl::StrSplit("Foo h\u00E4llo th\u4E1Ere", absl::ByAnyChar(" \t"));
+    EXPECT_THAT(v, ElementsAre("Foo", "h\u00E4llo", "th\u4E1Ere"));
   }
 }