Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(793)

Unified Diff: base/strings/string_util_unittest.cc

Issue 1399253004: Make base::IsUnicodeWhitespace('\0') return false. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add BASE_EXPORT Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/strings/string_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/strings/string_util_unittest.cc
diff --git a/base/strings/string_util_unittest.cc b/base/strings/string_util_unittest.cc
index 187e49e6698160e5629283371766f3df4629b09a..27274083ea2bf77b055c101e7c84ec21d06348bd 100644
--- a/base/strings/string_util_unittest.cc
+++ b/base/strings/string_util_unittest.cc
@@ -1080,6 +1080,23 @@ TEST(StringUtilTest, EqualsCaseInsensitiveASCII) {
EXPECT_FALSE(EqualsCaseInsensitiveASCII("Asdf", "aSDFz"));
}
+TEST(StringUtilTest, IsUnicodeWhitespace) {
+ // NOT unicode white space.
+ EXPECT_FALSE(IsUnicodeWhitespace(L'\0'));
+ EXPECT_FALSE(IsUnicodeWhitespace(L'A'));
+ EXPECT_FALSE(IsUnicodeWhitespace(L'0'));
+ EXPECT_FALSE(IsUnicodeWhitespace(L'.'));
+ EXPECT_FALSE(IsUnicodeWhitespace(L';'));
+
+ // Actual unicode whitespace.
+ EXPECT_TRUE(IsUnicodeWhitespace(L' '));
+ EXPECT_TRUE(IsUnicodeWhitespace(L'\t'));
+ EXPECT_TRUE(IsUnicodeWhitespace(L'\r'));
+ EXPECT_TRUE(IsUnicodeWhitespace(L'\v'));
+ EXPECT_TRUE(IsUnicodeWhitespace(L'\f'));
+ EXPECT_TRUE(IsUnicodeWhitespace(L'\n'));
brettw 2015/10/13 21:41:51 Can you add a non-ASCII one as well, like: 0xA0 (
eroman 2015/10/13 22:04:22 Done. (Also added a non-ASCII non-whitespace test)
+}
+
class WriteIntoTest : public testing::Test {
protected:
static void WritesCorrectly(size_t num_chars) {
« no previous file with comments | « base/strings/string_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698