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

Side by Side 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: Add wtf unit test 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 unified diff | Download patch
« no previous file with comments | « Source/wtf/text/StringImpl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 for (size_t i = 0; i < sizeof(testDataList) / sizeof(testDataList[0]); ++i) { 309 for (size_t i = 0; i < sizeof(testDataList) / sizeof(testDataList[0]); ++i) {
310 const char* expected = testDataList[i].expected; 310 const char* expected = testDataList[i].expected;
311 String source = String::fromUTF8(testDataList[i].source); 311 String source = String::fromUTF8(testDataList[i].source);
312 for (size_t j = 0; j < testDataList[i].localeListLength; ++j) { 312 for (size_t j = 0; j < testDataList[i].localeListLength; ++j) {
313 const char* locale = testDataList[i].localeList[j]; 313 const char* locale = testDataList[i].localeList[j];
314 EXPECT_STREQ(expected, source.lower(locale).utf8().data()) << testDa taList[i].sourceDescription << "; locale=" << locale; 314 EXPECT_STREQ(expected, source.lower(locale).utf8().data()) << testDa taList[i].sourceDescription << "; locale=" << locale;
315 } 315 }
316 } 316 }
317 } 317 }
318 318
319 TEST(WTF, StartsWithIgnoringASCIICase)
320 {
321 String allASCII("LINK");
322 String allASCIILowerCase("link");
323 ASSERT_TRUE(startsWithIgnoringASCIICase(allASCII, allASCIILowerCase));
tkent 2015/05/13 01:07:55 This should be EXPECT_TRUE(), not ASSERT_TRUE(). S
324 String allASCIIMixedCase("lInK");
325 ASSERT_TRUE(startsWithIgnoringASCIICase(allASCII, allASCIIMixedCase));
326 String allASCIIDifferent("foo");
327 ASSERT_FALSE(startsWithIgnoringASCIICase(allASCII, allASCIIDifferent));
328 String nonASCII = String::fromUTF8("LIN\xE2\x84\xAA");
329 ASSERT_FALSE(startsWithIgnoringASCIICase(allASCII, nonASCII));
330 ASSERT_TRUE(startsWithIgnoringASCIICase(allASCII, nonASCII.lower()));
331
332 ASSERT_FALSE(startsWithIgnoringASCIICase(nonASCII, allASCII));
333 ASSERT_FALSE(startsWithIgnoringASCIICase(nonASCII, allASCIILowerCase));
334 ASSERT_FALSE(startsWithIgnoringASCIICase(nonASCII, allASCIIMixedCase));
335 ASSERT_FALSE(startsWithIgnoringASCIICase(nonASCII, allASCIIDifferent));
336 }
337
319 } // namespace 338 } // namespace
OLDNEW
« 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