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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 } | 340 } |
341 | 341 |
342 TEST(StringTest, Lower) | 342 TEST(StringTest, Lower) |
343 { | 343 { |
344 EXPECT_STREQ("link", String("LINK").lower().ascii().data()); | 344 EXPECT_STREQ("link", String("LINK").lower().ascii().data()); |
345 EXPECT_STREQ("link", String("lInk").lower().ascii().data()); | 345 EXPECT_STREQ("link", String("lInk").lower().ascii().data()); |
346 EXPECT_STREQ("lin\xE1k", String("lIn\xC1k").lower().latin1().data()); | 346 EXPECT_STREQ("lin\xE1k", String("lIn\xC1k").lower().latin1().data()); |
347 EXPECT_STREQ("link", String::fromUTF8("LIN\xE2\x84\xAA").lower().utf8().data
()); | 347 EXPECT_STREQ("link", String::fromUTF8("LIN\xE2\x84\xAA").lower().utf8().data
()); |
348 } | 348 } |
349 | 349 |
| 350 TEST(StringTest, ToStdString) |
| 351 { |
| 352 char kAsciiChars[] = "1234"; |
| 353 EXPECT_EQ(std::string(kAsciiChars), String(kAsciiChars).toUTF8()); |
| 354 |
| 355 UChar kUTF16Chars[] = {0x20AC, 0xD801, 0}; |
| 356 EXPECT_EQ(std::string("\xE2\x82\xAC\xED\xA0\x81"), String(kUTF16Chars).toUTF
8()); |
| 357 |
| 358 } |
| 359 |
350 } // namespace WTF | 360 } // namespace WTF |
OLD | NEW |