summaryrefslogtreecommitdiff
path: root/absl/strings/strip_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/strings/strip_test.cc')
-rw-r--r--absl/strings/strip_test.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/absl/strings/strip_test.cc b/absl/strings/strip_test.cc
index ff0e7f1c..205c160c 100644
--- a/absl/strings/strip_test.cc
+++ b/absl/strings/strip_test.cc
@@ -178,4 +178,24 @@ TEST(String, StripLeadingAsciiWhitespace) {
EXPECT_EQ(absl::string_view(), absl::StripLeadingAsciiWhitespace(orig));
}
+TEST(Strip, StripAsciiWhitespace) {
+ std::string test2 = "\t \f\r\n\vfoo \t\f\r\v\n";
+ absl::StripAsciiWhitespace(&test2);
+ EXPECT_EQ(test2, "foo");
+ std::string test3 = "bar";
+ absl::StripAsciiWhitespace(&test3);
+ EXPECT_EQ(test3, "bar");
+ std::string test4 = "\t \f\r\n\vfoo";
+ absl::StripAsciiWhitespace(&test4);
+ EXPECT_EQ(test4, "foo");
+ std::string test5 = "foo \t\f\r\v\n";
+ absl::StripAsciiWhitespace(&test5);
+ EXPECT_EQ(test5, "foo");
+ absl::string_view test6("\t \f\r\n\vfoo \t\f\r\v\n");
+ test6 = absl::StripAsciiWhitespace(test6);
+ EXPECT_EQ(test6, "foo");
+ test6 = absl::StripAsciiWhitespace(test6);
+ EXPECT_EQ(test6, "foo"); // already stripped
+}
+
} // namespace