about summary refs log tree commit diff
path: root/absl
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2018-03-08T22·35-0800
committerAlex Strelnikov <strel@google.com>2018-03-12T16·43-0400
commit23ef7e11277a7a7709b70c362eea6b17cb932b34 (patch)
treeb6956133802081f52e93791a7c3aa7a58691f0e7 /absl
parent94f0f79ecd2d9e5271a21bc4ededea9b58c60674 (diff)
Changes imported from Abseil "staging" branch:
  - 50eadebdcad56fe50e8070b94497568c74175b28 Correct an example for StrSplit in the comments and chang... by Abseil Team <absl-team@google.com>

GitOrigin-RevId: 50eadebdcad56fe50e8070b94497568c74175b28
Change-Id: I2b12ce54e7d9db05ee15904801498f59e20e5d23
Diffstat (limited to 'absl')
-rw-r--r--absl/strings/str_split.h2
-rw-r--r--absl/strings/str_split_test.cc26
2 files changed, 14 insertions, 14 deletions
diff --git a/absl/strings/str_split.h b/absl/strings/str_split.h
index 713fdd0e6757..1f089b9377b2 100644
--- a/absl/strings/str_split.h
+++ b/absl/strings/str_split.h
@@ -402,7 +402,7 @@ struct SkipWhitespace {
 //
 //   std::vector<std::string> v = absl::StrSplit(" a , ,,b,",
 //                                               ',', SkipWhitespace());
-//   // v[0] == "a", v[1] == "b"
+//   // v[0] == " a ", v[1] == "b"
 //
 // See above for more information on predicates.
 //
diff --git a/absl/strings/str_split_test.cc b/absl/strings/str_split_test.cc
index 16b047a1de85..c172a7629933 100644
--- a/absl/strings/str_split_test.cc
+++ b/absl/strings/str_split_test.cc
@@ -154,8 +154,8 @@ TEST(Split, APIExamples) {
   {
     // Uses the SkipWhitespace predicate.
     using absl::SkipWhitespace;
-    std::vector<std::string> v = absl::StrSplit("a, ,,b,", ',', SkipWhitespace());
-    EXPECT_THAT(v, ElementsAre("a", "b"));
+    std::vector<std::string> v = absl::StrSplit(" a , ,,b,", ',', SkipWhitespace());
+    EXPECT_THAT(v, ElementsAre(" a ", "b"));
   }
 
   {
@@ -241,10 +241,10 @@ TEST(SplitIterator, Basics) {
 
   EXPECT_NE(it, end);
   EXPECT_EQ("a", *it);  // tests dereference
-  ++it;  // tests preincrement
+  ++it;                 // tests preincrement
   EXPECT_NE(it, end);
   EXPECT_EQ("b", std::string(it->data(), it->size()));  // tests dereference as ptr
-  it++;  // tests postincrement
+  it++;                                            // tests postincrement
   EXPECT_EQ(it, end);
 }
 
@@ -265,10 +265,10 @@ TEST(SplitIterator, Predicate) {
 
   EXPECT_NE(it, end);
   EXPECT_EQ("a", *it);  // tests dereference
-  ++it;  // tests preincrement -- "b" should be skipped here.
+  ++it;                 // tests preincrement -- "b" should be skipped here.
   EXPECT_NE(it, end);
   EXPECT_EQ("c", std::string(it->data(), it->size()));  // tests dereference as ptr
-  it++;  // tests postincrement
+  it++;                                            // tests postincrement
   EXPECT_EQ(it, end);
 }
 
@@ -278,13 +278,13 @@ TEST(SplitIterator, EdgeCases) {
     std::string in;
     std::vector<std::string> expect;
   } specs[] = {
-    {"", {""}},
-    {"foo", {"foo"}},
-    {",", {"", ""}},
-    {",foo", {"", "foo"}},
-    {"foo,", {"foo", ""}},
-    {",foo,", {"", "foo", ""}},
-    {"foo,bar", {"foo", "bar"}},
+      {"", {""}},
+      {"foo", {"foo"}},
+      {",", {"", ""}},
+      {",foo", {"", "foo"}},
+      {"foo,", {"foo", ""}},
+      {",foo,", {"", "foo", ""}},
+      {"foo,bar", {"foo", "bar"}},
   };
 
   for (const auto& spec : specs) {