| 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 30 matching lines...) Expand all Loading... |
| 41 } | 41 } |
| 42 | 42 |
| 43 TEST(StringTest, ASCII) { | 43 TEST(StringTest, ASCII) { |
| 44 CString output; | 44 CString output; |
| 45 | 45 |
| 46 // Null String. | 46 // Null String. |
| 47 output = String().ascii(); | 47 output = String().ascii(); |
| 48 EXPECT_STREQ("", output.data()); | 48 EXPECT_STREQ("", output.data()); |
| 49 | 49 |
| 50 // Empty String. | 50 // Empty String. |
| 51 output = emptyString().ascii(); | 51 output = emptyString.ascii(); |
| 52 EXPECT_STREQ("", output.data()); | 52 EXPECT_STREQ("", output.data()); |
| 53 | 53 |
| 54 // Regular String. | 54 // Regular String. |
| 55 output = String("foobar").ascii(); | 55 output = String("foobar").ascii(); |
| 56 EXPECT_STREQ("foobar", output.data()); | 56 EXPECT_STREQ("foobar", output.data()); |
| 57 } | 57 } |
| 58 | 58 |
| 59 namespace { | 59 namespace { |
| 60 | 60 |
| 61 void testNumberToStringECMAScript(double number, const char* reference) { | 61 void testNumberToStringECMAScript(double number, const char* reference) { |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 CString("\"\\u0008\\t\\n\\u000B\\u000C\\r\\u000E\\u000F\""), | 482 CString("\"\\u0008\\t\\n\\u000B\\u000C\\r\\u000E\\u000F\""), |
| 483 toCStringThroughPrinter(String("\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F", 8))); | 483 toCStringThroughPrinter(String("\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F", 8))); |
| 484 EXPECT_EQ( | 484 EXPECT_EQ( |
| 485 CString("\"\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\u0016\\u0017\""), | 485 CString("\"\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\u0016\\u0017\""), |
| 486 toCStringThroughPrinter(String("\x10\x11\x12\x13\x14\x15\x16\x17", 8))); | 486 toCStringThroughPrinter(String("\x10\x11\x12\x13\x14\x15\x16\x17", 8))); |
| 487 EXPECT_EQ( | 487 EXPECT_EQ( |
| 488 CString("\"\\u0018\\u0019\\u001A\\u001B\\u001C\\u001D\\u001E\\u001F\""), | 488 CString("\"\\u0018\\u0019\\u001A\\u001B\\u001C\\u001D\\u001E\\u001F\""), |
| 489 toCStringThroughPrinter(String("\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F", 8))); | 489 toCStringThroughPrinter(String("\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F", 8))); |
| 490 EXPECT_EQ(CString("\"\\u007F\\u0080\\u0081\""), | 490 EXPECT_EQ(CString("\"\\u007F\\u0080\\u0081\""), |
| 491 toCStringThroughPrinter("\x7F\x80\x81")); | 491 toCStringThroughPrinter("\x7F\x80\x81")); |
| 492 EXPECT_EQ(CString("\"\""), toCStringThroughPrinter(emptyString())); | 492 EXPECT_EQ(CString("\"\""), toCStringThroughPrinter(emptyString)); |
| 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 |
| OLD | NEW |