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

Side by Side Diff: third_party/WebKit/Source/wtf/text/WTFStringTest.cpp

Issue 2508033004: Reduce unnecessary usage of TextCaseSensitivity::TextCaseInsensitive. (Closed)
Patch Set: Created 4 years, 1 month 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 | « third_party/WebKit/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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 const char* locale = testDataList[i].localeList[j]; 332 const char* locale = testDataList[i].localeList[j];
333 EXPECT_STREQ(expected, source.lower(locale).utf8().data()) 333 EXPECT_STREQ(expected, source.lower(locale).utf8().data())
334 << testDataList[i].sourceDescription << "; locale=" << locale; 334 << testDataList[i].sourceDescription << "; locale=" << locale;
335 } 335 }
336 } 336 }
337 } 337 }
338 338
339 TEST(StringTest, StartsWithIgnoringUnicodeCase) { 339 TEST(StringTest, StartsWithIgnoringUnicodeCase) {
340 // [U+017F U+212A i a] starts with "sk". 340 // [U+017F U+212A i a] starts with "sk".
341 EXPECT_TRUE(String::fromUTF8("\xC5\xBF\xE2\x84\xAAia") 341 EXPECT_TRUE(String::fromUTF8("\xC5\xBF\xE2\x84\xAAia")
342 .startsWith("sk", TextCaseInsensitive)); 342 .startsWith("sk", TextCaseUnicodeInsensitive));
343 } 343 }
344 344
345 TEST(StringTest, StartsWithIgnoringASCIICase) { 345 TEST(StringTest, StartsWithIgnoringASCIICase) {
346 String allASCII("LINK"); 346 String allASCII("LINK");
347 String allASCIILowerCase("link"); 347 String allASCIILowerCase("link");
348 EXPECT_TRUE(allASCII.startsWith(allASCIILowerCase, TextCaseASCIIInsensitive)); 348 EXPECT_TRUE(allASCII.startsWith(allASCIILowerCase, TextCaseASCIIInsensitive));
349 String allASCIIMixedCase("lInK"); 349 String allASCIIMixedCase("lInK");
350 EXPECT_TRUE(allASCII.startsWith(allASCIIMixedCase, TextCaseASCIIInsensitive)); 350 EXPECT_TRUE(allASCII.startsWith(allASCIIMixedCase, TextCaseASCIIInsensitive));
351 String allASCIIDifferent("foo"); 351 String allASCIIDifferent("foo");
352 EXPECT_FALSE( 352 EXPECT_FALSE(
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 EXPECT_EQ(CString("<null>"), toCStringThroughPrinter(String())); 493 EXPECT_EQ(CString("<null>"), toCStringThroughPrinter(String()));
494 494
495 static const UChar unicodeSample[] = {0x30C6, 0x30B9, 495 static const UChar unicodeSample[] = {0x30C6, 0x30B9,
496 0x30C8}; // "Test" in Japanese. 496 0x30C8}; // "Test" in Japanese.
497 EXPECT_EQ(CString("\"\\u30C6\\u30B9\\u30C8\""), 497 EXPECT_EQ(CString("\"\\u30C6\\u30B9\\u30C8\""),
498 toCStringThroughPrinter( 498 toCStringThroughPrinter(
499 String(unicodeSample, WTF_ARRAY_LENGTH(unicodeSample)))); 499 String(unicodeSample, WTF_ARRAY_LENGTH(unicodeSample))));
500 } 500 }
501 501
502 } // namespace WTF 502 } // namespace WTF
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/text/StringImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698