about summary refs log tree commit diff
path: root/absl/strings/str_split_test.cc
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2018-01-03T17·52-0800
committerJon Cohen <cohenjon@google.com>2018-01-03T22·34-0500
commit0271cd35577599fa99b59202da17d3136956e4c0 (patch)
treef8edb7f43c66b34be85368a89414882870ebee0b /absl/strings/str_split_test.cc
parent6365d1744b405cec48317e9597a80533acab0798 (diff)
Changes imported from Abseil "staging" branch:
  - 6e88015f26885b66ce9b11696eb9c8d96ef7c0f6 Add ABSL_MUST_USE_RESULT to absl::StripPrefix and absl::S... by Mark Barolak <mbar@google.com>
  - 47d8de97748da346ad2a962f27389e0380a7a716 Fix missing header include when compiling with _GLIBCXX_D... by Alex Strelnikov <strel@google.com>

GitOrigin-RevId: 6e88015f26885b66ce9b11696eb9c8d96ef7c0f6
Change-Id: I8698c77d9eab81455b209a6bef4bb2d5b32ebd65
Diffstat (limited to 'absl/strings/str_split_test.cc')
-rw-r--r--absl/strings/str_split_test.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/absl/strings/str_split_test.cc b/absl/strings/str_split_test.cc
index 9c79d7dcd0bf..500f3cbc3789 100644
--- a/absl/strings/str_split_test.cc
+++ b/absl/strings/str_split_test.cc
@@ -166,6 +166,18 @@ TEST(Split, APIExamples) {
   }
 
   {
+    // Different forms of initialization / conversion.
+    std::vector<std::string> v1 = absl::StrSplit("a,b,c", ',');
+    EXPECT_THAT(v1, ElementsAre("a", "b", "c"));
+    std::vector<std::string> v2(absl::StrSplit("a,b,c", ','));
+    EXPECT_THAT(v2, ElementsAre("a", "b", "c"));
+    auto v3 = std::vector<std::string>(absl::StrSplit("a,b,c", ','));
+    EXPECT_THAT(v3, ElementsAre("a", "b", "c"));
+    v3 = absl::StrSplit("a,b,c", ',');
+    EXPECT_THAT(v3, ElementsAre("a", "b", "c"));
+  }
+
+  {
     // Results stored in a std::map.
     std::map<std::string, std::string> m = absl::StrSplit("a,1,b,2,a,3", ',');
     EXPECT_EQ(2, m.size());