| 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 "platform/globals.h" | 5 #include "platform/globals.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 4708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4719 }; | 4719 }; |
| 4720 String& test = String::Handle(); | 4720 String& test = String::Handle(); |
| 4721 String& result = String::Handle(); | 4721 String& result = String::Handle(); |
| 4722 for (size_t i = 0; i < ARRAY_SIZE(tests); i++) { | 4722 for (size_t i = 0; i < ARRAY_SIZE(tests); i++) { |
| 4723 test = String::New(tests[i].in); | 4723 test = String::New(tests[i].in); |
| 4724 result = String::ScrubName(test); | 4724 result = String::ScrubName(test); |
| 4725 EXPECT_STREQ(tests[i].out, result.ToCString()); | 4725 EXPECT_STREQ(tests[i].out, result.ToCString()); |
| 4726 } | 4726 } |
| 4727 } | 4727 } |
| 4728 | 4728 |
| 4729 |
| 4730 VM_TEST_CASE(String_EqualsUTF32) { |
| 4731 // Regression test for Issue 27433. Checks that comparisons between Strings |
| 4732 // and utf32 arrays happens after conversion to utf16 instead of utf32, as |
| 4733 // required for proper canonicalization of string literals with a lossy |
| 4734 // utf32->utf16 conversion. |
| 4735 int32_t char_codes[] = { |
| 4736 0, 0x0a, 0x0d, 0x7f, 0xff, 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff |
| 4737 }; |
| 4738 |
| 4739 const String& str = |
| 4740 String::Handle(String::FromUTF32(char_codes, ARRAY_SIZE(char_codes))); |
| 4741 EXPECT(str.Equals(char_codes, ARRAY_SIZE(char_codes))); |
| 4742 } |
| 4743 |
| 4729 } // namespace dart | 4744 } // namespace dart |
| OLD | NEW |