summaryrefslogtreecommitdiff
path: root/absl/strings/strip_test.cc
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2018-01-05 07:54:33 -0800
committerGravatar Derek Mauro <dmauro@google.com>2018-01-08 10:38:50 -0500
commit4132ce25956a91e1224e0f205b7f8c326304a995 (patch)
tree724485e8778f91d865db86af663af9e7be3293db /absl/strings/strip_test.cc
parent0271cd35577599fa99b59202da17d3136956e4c0 (diff)
Changes imported from Abseil "staging" branch:
- 0a519d9a4507158267cc515e0c7c83959d94fc78 Fix missing header include when compiling with _GLIBCXX_D... by Alex Strelnikov <strel@google.com> - d089af70781d92af9a5de2d84c417ddf2c87689a Internal change by Gennadiy Rozental <rogeeff@google.com> - 0d3afc89d3907923ede964d58c6bcca579e8ad65 Test absl::any for exception safety. This test is tempor... by Jon Cohen <cohenjon@google.com> - 29af424b8a3174a7b3e657e478aa30a8a425aee2 Tweak the ABSL type trait library and expand its tests. by Abseil Team <absl-team@google.com> - 99ab42b2ebbe466cc3730fb6b16b5fad848f95af Rollback GLIBCXX_DEBUG fix due to internal breakage. by Alex Strelnikov <strel@google.com> - 1a5bcb93ee16d4dd2170254e54c4b62b38fbf17b Internal change. by Abseil Team <absl-team@google.com> - 46de7d09c7d4aef5b7b5389ce9b4f96b654aac02 absl::string_view::rfind: doc fix. by Abseil Team <absl-team@google.com> - edda4c7ddd2d76fbb5b3fd5226b95082083c57d9 Fix string_view_test with c++17/clang/libc++ to address by Xiaoyi Zhang <zhangxy@google.com> GitOrigin-RevId: 0a519d9a4507158267cc515e0c7c83959d94fc78 Change-Id: Ie27de1be3e79bba011f05e924d34e8fcc62d8de5
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