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

Unified Diff: Source/wtf/text/WTFStringTest.cpp

Issue 1129313003: Compare :lang value case-insensitive in ASCII range (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use EXPECT instead of ASSERT Created 5 years, 7 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 | « Source/wtf/text/StringImpl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/text/WTFStringTest.cpp
diff --git a/Source/wtf/text/WTFStringTest.cpp b/Source/wtf/text/WTFStringTest.cpp
index adbb7b11b51cd6e245f65186321a0cb472794297..26f882e5faa176193b583962342fc13bb81b63bf 100644
--- a/Source/wtf/text/WTFStringTest.cpp
+++ b/Source/wtf/text/WTFStringTest.cpp
@@ -316,4 +316,23 @@ TEST(WTF, StringToLowerLocale)
}
}
+TEST(WTF, StartsWithIgnoringASCIICase)
+{
+ String allASCII("LINK");
+ String allASCIILowerCase("link");
+ EXPECT_TRUE(startsWithIgnoringASCIICase(allASCII, allASCIILowerCase));
+ String allASCIIMixedCase("lInK");
+ EXPECT_TRUE(startsWithIgnoringASCIICase(allASCII, allASCIIMixedCase));
+ String allASCIIDifferent("foo");
+ EXPECT_FALSE(startsWithIgnoringASCIICase(allASCII, allASCIIDifferent));
+ String nonASCII = String::fromUTF8("LIN\xE2\x84\xAA");
+ EXPECT_FALSE(startsWithIgnoringASCIICase(allASCII, nonASCII));
+ EXPECT_TRUE(startsWithIgnoringASCIICase(allASCII, nonASCII.lower()));
+
+ EXPECT_FALSE(startsWithIgnoringASCIICase(nonASCII, allASCII));
+ EXPECT_FALSE(startsWithIgnoringASCIICase(nonASCII, allASCIILowerCase));
+ EXPECT_FALSE(startsWithIgnoringASCIICase(nonASCII, allASCIIMixedCase));
+ EXPECT_FALSE(startsWithIgnoringASCIICase(nonASCII, allASCIIDifferent));
+}
+
} // namespace
« no previous file with comments | « Source/wtf/text/StringImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698