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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 |
OLD | NEW |