Chromium Code Reviews| 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 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1537 const String& str = | 1537 const String& str = |
| 1538 String::Handle( | 1538 String::Handle( |
| 1539 OneByteString::New(characters, len, Heap::kNew)); | 1539 OneByteString::New(characters, len, Heap::kNew)); |
| 1540 EXPECT(str.IsOneByteString()); | 1540 EXPECT(str.IsOneByteString()); |
| 1541 EXPECT_EQ(str.Length(), len); | 1541 EXPECT_EQ(str.Length(), len); |
| 1542 EXPECT(str.Equals("a\n\f\b\t\v\r\\$z")); | 1542 EXPECT(str.Equals("a\n\f\b\t\v\r\\$z")); |
| 1543 const String& escaped_str = | 1543 const String& escaped_str = |
| 1544 String::Handle(String::EscapeSpecialCharacters(str)); | 1544 String::Handle(String::EscapeSpecialCharacters(str)); |
| 1545 EXPECT(escaped_str.Equals("a\\n\\f\\b\\t\\v\\r\\\\\\$z")); | 1545 EXPECT(escaped_str.Equals("a\\n\\f\\b\\t\\v\\r\\\\\\$z")); |
| 1546 | 1546 |
| 1547 const String& empty_str = String::Handle(OneByteString::New(0, Heap::kNew)); | 1547 const String& empty_str = String::Handle( |
| 1548 OneByteString::New(static_cast<intptr_t>(0), Heap::kNew)); | |
|
Ivan Posva
2013/10/01 03:21:23
You can remove the this whole line and replace the
| |
| 1548 const String& escaped_empty_str = | 1549 const String& escaped_empty_str = |
| 1549 String::Handle(String::EscapeSpecialCharacters(empty_str)); | 1550 String::Handle(String::EscapeSpecialCharacters(empty_str)); |
| 1550 EXPECT_EQ(empty_str.Length(), 0); | 1551 EXPECT_EQ(empty_str.Length(), 0); |
|
Ivan Posva
2013/10/01 03:21:23
This is a redundant check. If Symbols::Empty() is
| |
| 1551 EXPECT_EQ(escaped_empty_str.Length(), 0); | 1552 EXPECT_EQ(escaped_empty_str.Length(), 0); |
| 1552 } | 1553 } |
| 1553 | 1554 |
| 1554 | 1555 |
| 1555 TEST_CASE(EscapeSpecialCharactersExternalOneByteString) { | 1556 TEST_CASE(EscapeSpecialCharactersExternalOneByteString) { |
| 1556 uint8_t characters[] = | 1557 uint8_t characters[] = |
| 1557 { 'a', '\n', '\f', '\b', '\t', '\v', '\r', '\\', '$', 'z' }; | 1558 { 'a', '\n', '\f', '\b', '\t', '\v', '\r', '\\', '$', 'z' }; |
| 1558 intptr_t len = ARRAY_SIZE(characters); | 1559 intptr_t len = ARRAY_SIZE(characters); |
| 1559 | 1560 |
| 1560 const String& str = | 1561 const String& str = |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 1584 | 1585 |
| 1585 const String& str = | 1586 const String& str = |
| 1586 String::Handle(TwoByteString::New(characters, len, Heap::kNew)); | 1587 String::Handle(TwoByteString::New(characters, len, Heap::kNew)); |
| 1587 EXPECT(str.IsTwoByteString()); | 1588 EXPECT(str.IsTwoByteString()); |
| 1588 EXPECT_EQ(str.Length(), len); | 1589 EXPECT_EQ(str.Length(), len); |
| 1589 EXPECT(str.Equals("a\n\f\b\t\v\r\\$z")); | 1590 EXPECT(str.Equals("a\n\f\b\t\v\r\\$z")); |
| 1590 const String& escaped_str = | 1591 const String& escaped_str = |
| 1591 String::Handle(String::EscapeSpecialCharacters(str)); | 1592 String::Handle(String::EscapeSpecialCharacters(str)); |
| 1592 EXPECT(escaped_str.Equals("a\\n\\f\\b\\t\\v\\r\\\\\\$z")); | 1593 EXPECT(escaped_str.Equals("a\\n\\f\\b\\t\\v\\r\\\\\\$z")); |
| 1593 | 1594 |
| 1594 const String& empty_str = String::Handle(TwoByteString::New(0, Heap::kNew)); | 1595 const String& empty_str = |
| 1596 String::Handle(TwoByteString::New(static_cast<intptr_t>(0), Heap::kNew)); | |
| 1595 const String& escaped_empty_str = | 1597 const String& escaped_empty_str = |
| 1596 String::Handle(String::EscapeSpecialCharacters(empty_str)); | 1598 String::Handle(String::EscapeSpecialCharacters(empty_str)); |
| 1597 EXPECT_EQ(empty_str.Length(), 0); | 1599 EXPECT_EQ(empty_str.Length(), 0); |
| 1598 EXPECT_EQ(escaped_empty_str.Length(), 0); | 1600 EXPECT_EQ(escaped_empty_str.Length(), 0); |
| 1599 } | 1601 } |
| 1600 | 1602 |
| 1601 | 1603 |
| 1602 TEST_CASE(EscapeSpecialCharactersExternalTwoByteString) { | 1604 TEST_CASE(EscapeSpecialCharactersExternalTwoByteString) { |
| 1603 uint16_t characters[] = | 1605 uint16_t characters[] = |
| 1604 { 'a', '\n', '\f', '\b', '\t', '\v', '\r', '\\', '$', 'z' }; | 1606 { 'a', '\n', '\f', '\b', '\t', '\v', '\r', '\\', '$', 'z' }; |
| (...skipping 1966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3571 cls = Object::dynamic_class(); | 3573 cls = Object::dynamic_class(); |
| 3572 array = cls.fields(); | 3574 array = cls.fields(); |
| 3573 EXPECT(!array.IsNull()); | 3575 EXPECT(!array.IsNull()); |
| 3574 EXPECT(array.IsArray()); | 3576 EXPECT(array.IsArray()); |
| 3575 array = cls.functions(); | 3577 array = cls.functions(); |
| 3576 EXPECT(!array.IsNull()); | 3578 EXPECT(!array.IsNull()); |
| 3577 EXPECT(array.IsArray()); | 3579 EXPECT(array.IsArray()); |
| 3578 } | 3580 } |
| 3579 | 3581 |
| 3580 } // namespace dart | 3582 } // namespace dart |
| OLD | NEW |