| OLD | NEW | 
|---|
| 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 268           "X\xC4\xAE\xCC\x88", | 268           "X\xC4\xAE\xCC\x88", | 
| 269       }, | 269       }, | 
| 270   }; | 270   }; | 
| 271 | 271 | 
| 272   for (size_t i = 0; i < sizeof(test_data_list) / sizeof(test_data_list[0]); | 272   for (size_t i = 0; i < sizeof(test_data_list) / sizeof(test_data_list[0]); | 
| 273        ++i) { | 273        ++i) { | 
| 274     const char* expected = test_data_list[i].expected; | 274     const char* expected = test_data_list[i].expected; | 
| 275     String source = String::FromUTF8(test_data_list[i].source); | 275     String source = String::FromUTF8(test_data_list[i].source); | 
| 276     for (size_t j = 0; j < test_data_list[i].locale_list_length; ++j) { | 276     for (size_t j = 0; j < test_data_list[i].locale_list_length; ++j) { | 
| 277       const char* locale = test_data_list[i].locale_list[j]; | 277       const char* locale = test_data_list[i].locale_list[j]; | 
| 278       EXPECT_STREQ(expected, source.Upper(locale).Utf8().Data()) | 278       EXPECT_STREQ(expected, source.UpperUnicode(locale).Utf8().Data()) | 
| 279           << test_data_list[i].source_description << "; locale=" << locale; | 279           << test_data_list[i].source_description << "; locale=" << locale; | 
| 280     } | 280     } | 
| 281   } | 281   } | 
| 282 } | 282 } | 
| 283 | 283 | 
| 284 TEST(StringTest, ToLowerLocale) { | 284 TEST(StringTest, ToLowerLocale) { | 
| 285   CaseFoldingTestData test_data_list[] = { | 285   CaseFoldingTestData test_data_list[] = { | 
| 286       { | 286       { | 
| 287           "Turkic input", g_turkic_input, g_turkic_locales, | 287           "Turkic input", g_turkic_input, g_turkic_locales, | 
| 288           sizeof(g_turkic_locales) / sizeof(const char*), | 288           sizeof(g_turkic_locales) / sizeof(const char*), | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 328           "\x78\xC4\xAF\xCC\x88", | 328           "\x78\xC4\xAF\xCC\x88", | 
| 329       }, | 329       }, | 
| 330   }; | 330   }; | 
| 331 | 331 | 
| 332   for (size_t i = 0; i < sizeof(test_data_list) / sizeof(test_data_list[0]); | 332   for (size_t i = 0; i < sizeof(test_data_list) / sizeof(test_data_list[0]); | 
| 333        ++i) { | 333        ++i) { | 
| 334     const char* expected = test_data_list[i].expected; | 334     const char* expected = test_data_list[i].expected; | 
| 335     String source = String::FromUTF8(test_data_list[i].source); | 335     String source = String::FromUTF8(test_data_list[i].source); | 
| 336     for (size_t j = 0; j < test_data_list[i].locale_list_length; ++j) { | 336     for (size_t j = 0; j < test_data_list[i].locale_list_length; ++j) { | 
| 337       const char* locale = test_data_list[i].locale_list[j]; | 337       const char* locale = test_data_list[i].locale_list[j]; | 
| 338       EXPECT_STREQ(expected, source.Lower(locale).Utf8().Data()) | 338       EXPECT_STREQ(expected, source.LowerUnicode(locale).Utf8().Data()) | 
| 339           << test_data_list[i].source_description << "; locale=" << locale; | 339           << test_data_list[i].source_description << "; locale=" << locale; | 
| 340     } | 340     } | 
| 341   } | 341   } | 
| 342 } | 342 } | 
| 343 | 343 | 
| 344 TEST(StringTest, StartsWithIgnoringUnicodeCase) { | 344 TEST(StringTest, StartsWithIgnoringUnicodeCase) { | 
| 345   // [U+017F U+212A i a] starts with "sk". | 345   // [U+017F U+212A i a] starts with "sk". | 
| 346   EXPECT_TRUE(String::FromUTF8("\xC5\xBF\xE2\x84\xAAia") | 346   EXPECT_TRUE(String::FromUTF8("\xC5\xBF\xE2\x84\xAAia") | 
| 347                   .StartsWith("sk", kTextCaseUnicodeInsensitive)); | 347                   .StartsWith("sk", kTextCaseUnicodeInsensitive)); | 
| 348 } | 348 } | 
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 512   EXPECT_EQ(CString("<null>"), ToCStringThroughPrinter(String())); | 512   EXPECT_EQ(CString("<null>"), ToCStringThroughPrinter(String())); | 
| 513 | 513 | 
| 514   static const UChar kUnicodeSample[] = {0x30C6, 0x30B9, | 514   static const UChar kUnicodeSample[] = {0x30C6, 0x30B9, | 
| 515                                          0x30C8};  // "Test" in Japanese. | 515                                          0x30C8};  // "Test" in Japanese. | 
| 516   EXPECT_EQ(CString("\"\\u30C6\\u30B9\\u30C8\""), | 516   EXPECT_EQ(CString("\"\\u30C6\\u30B9\\u30C8\""), | 
| 517             ToCStringThroughPrinter( | 517             ToCStringThroughPrinter( | 
| 518                 String(kUnicodeSample, WTF_ARRAY_LENGTH(kUnicodeSample)))); | 518                 String(kUnicodeSample, WTF_ARRAY_LENGTH(kUnicodeSample)))); | 
| 519 } | 519 } | 
| 520 | 520 | 
| 521 }  // namespace WTF | 521 }  // namespace WTF | 
| OLD | NEW | 
|---|