| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/assembler.h" | 5 #include "vm/assembler.h" |
| 6 #include "vm/bigint_operations.h" | 6 #include "vm/bigint_operations.h" |
| 7 #include "vm/class_finalizer.h" | 7 #include "vm/class_finalizer.h" |
| 8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
| (...skipping 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1522 EXPECT(concat.Equals("\xC3\xB6\xC3\xB1\xC3\xA9\xC3\xB6\xC3\xB1\xC3\xA9")); | 1522 EXPECT(concat.Equals("\xC3\xB6\xC3\xB1\xC3\xA9\xC3\xB6\xC3\xB1\xC3\xA9")); |
| 1523 | 1523 |
| 1524 const String& substr = String::Handle(String::SubString(str, 1, 1)); | 1524 const String& substr = String::Handle(String::SubString(str, 1, 1)); |
| 1525 EXPECT(!substr.IsExternalOneByteString()); | 1525 EXPECT(!substr.IsExternalOneByteString()); |
| 1526 EXPECT(substr.IsOneByteString()); | 1526 EXPECT(substr.IsOneByteString()); |
| 1527 EXPECT_EQ(1, substr.Length()); | 1527 EXPECT_EQ(1, substr.Length()); |
| 1528 EXPECT(substr.Equals("\xC3\xB1")); | 1528 EXPECT(substr.Equals("\xC3\xB1")); |
| 1529 } | 1529 } |
| 1530 | 1530 |
| 1531 | 1531 |
| 1532 TEST_CASE(EscapeSpecialCharactersOneByteString) { |
| 1533 uint8_t characters[] = |
| 1534 { 'a', '\n', '\f', '\b', '\t', '\v', '\r', '\\', '$', 'z' }; |
| 1535 intptr_t len = ARRAY_SIZE(characters); |
| 1536 |
| 1537 const String& str = |
| 1538 String::Handle( |
| 1539 OneByteString::New(characters, len, Heap::kNew)); |
| 1540 EXPECT(str.IsOneByteString()); |
| 1541 EXPECT_EQ(str.Length(), len); |
| 1542 EXPECT(str.Equals("a\n\f\b\t\v\r\\$z")); |
| 1543 const String& escaped_str = |
| 1544 String::Handle(String::EscapeSpecialCharacters(str)); |
| 1545 EXPECT(escaped_str.Equals("a\\n\\f\\b\\t\\v\\r\\\\\\$z")); |
| 1546 } |
| 1547 |
| 1548 |
| 1549 TEST_CASE(EscapeSpecialCharactersExternalOneByteString) { |
| 1550 uint8_t characters[] = |
| 1551 { 'a', '\n', '\f', '\b', '\t', '\v', '\r', '\\', '$', 'z' }; |
| 1552 intptr_t len = ARRAY_SIZE(characters); |
| 1553 |
| 1554 const String& str = |
| 1555 String::Handle( |
| 1556 ExternalOneByteString::New(characters, len, NULL, NULL, Heap::kNew)); |
| 1557 EXPECT(!str.IsOneByteString()); |
| 1558 EXPECT(str.IsExternalOneByteString()); |
| 1559 EXPECT_EQ(str.Length(), len); |
| 1560 EXPECT(str.Equals("a\n\f\b\t\v\r\\$z")); |
| 1561 const String& escaped_str = |
| 1562 String::Handle(String::EscapeSpecialCharacters(str)); |
| 1563 EXPECT(escaped_str.Equals("a\\n\\f\\b\\t\\v\\r\\\\\\$z")); |
| 1564 } |
| 1565 |
| 1566 TEST_CASE(EscapeSpecialCharactersTwoByteString) { |
| 1567 uint16_t characters[] = |
| 1568 { 'a', '\n', '\f', '\b', '\t', '\v', '\r', '\\', '$', 'z' }; |
| 1569 intptr_t len = ARRAY_SIZE(characters); |
| 1570 |
| 1571 const String& str = |
| 1572 String::Handle(TwoByteString::New(characters, len, Heap::kNew)); |
| 1573 EXPECT(str.IsTwoByteString()); |
| 1574 EXPECT_EQ(str.Length(), len); |
| 1575 EXPECT(str.Equals("a\n\f\b\t\v\r\\$z")); |
| 1576 const String& escaped_str = |
| 1577 String::Handle(String::EscapeSpecialCharacters(str)); |
| 1578 EXPECT(escaped_str.Equals("a\\n\\f\\b\\t\\v\\r\\\\\\$z")); |
| 1579 } |
| 1580 |
| 1581 |
| 1582 TEST_CASE(EscapeSpecialCharactersExternalTwoByteString) { |
| 1583 uint16_t characters[] = |
| 1584 { 'a', '\n', '\f', '\b', '\t', '\v', '\r', '\\', '$', 'z' }; |
| 1585 intptr_t len = ARRAY_SIZE(characters); |
| 1586 |
| 1587 const String& str = |
| 1588 String::Handle( |
| 1589 ExternalTwoByteString::New(characters, len, NULL, NULL, Heap::kNew)); |
| 1590 EXPECT(str.IsExternalTwoByteString()); |
| 1591 EXPECT_EQ(str.Length(), len); |
| 1592 EXPECT(str.Equals("a\n\f\b\t\v\r\\$z")); |
| 1593 const String& escaped_str = |
| 1594 String::Handle(String::EscapeSpecialCharacters(str)); |
| 1595 EXPECT(escaped_str.Equals("a\\n\\f\\b\\t\\v\\r\\\\\\$z")); |
| 1596 } |
| 1597 |
| 1598 |
| 1532 TEST_CASE(ExternalTwoByteString) { | 1599 TEST_CASE(ExternalTwoByteString) { |
| 1533 uint16_t characters[] = { 0x1E6B, 0x1E85, 0x1E53 }; | 1600 uint16_t characters[] = { 0x1E6B, 0x1E85, 0x1E53 }; |
| 1534 intptr_t len = ARRAY_SIZE(characters); | 1601 intptr_t len = ARRAY_SIZE(characters); |
| 1535 | 1602 |
| 1536 const String& str = | 1603 const String& str = |
| 1537 String::Handle( | 1604 String::Handle( |
| 1538 ExternalTwoByteString::New(characters, len, NULL, NULL, Heap::kNew)); | 1605 ExternalTwoByteString::New(characters, len, NULL, NULL, Heap::kNew)); |
| 1539 EXPECT(!str.IsTwoByteString()); | 1606 EXPECT(!str.IsTwoByteString()); |
| 1540 EXPECT(str.IsExternalTwoByteString()); | 1607 EXPECT(str.IsExternalTwoByteString()); |
| 1541 EXPECT_EQ(str.Length(), len); | 1608 EXPECT_EQ(str.Length(), len); |
| (...skipping 1934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3476 cls = Object::dynamic_class(); | 3543 cls = Object::dynamic_class(); |
| 3477 array = cls.fields(); | 3544 array = cls.fields(); |
| 3478 EXPECT(!array.IsNull()); | 3545 EXPECT(!array.IsNull()); |
| 3479 EXPECT(array.IsArray()); | 3546 EXPECT(array.IsArray()); |
| 3480 array = cls.functions(); | 3547 array = cls.functions(); |
| 3481 EXPECT(!array.IsNull()); | 3548 EXPECT(!array.IsNull()); |
| 3482 EXPECT(array.IsArray()); | 3549 EXPECT(array.IsArray()); |
| 3483 } | 3550 } |
| 3484 | 3551 |
| 3485 } // namespace dart | 3552 } // namespace dart |
| OLD | NEW |