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 "include/dart_debugger_api.h" | 5 #include "include/dart_debugger_api.h" |
6 #include "platform/assert.h" | 6 #include "platform/assert.h" |
7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.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_api_message.h" | 10 #include "vm/dart_api_message.h" |
11 #include "vm/dart_api_state.h" | 11 #include "vm/dart_api_state.h" |
12 #include "vm/snapshot.h" | 12 #include "vm/snapshot.h" |
| 13 #include "vm/symbols.h" |
13 #include "vm/unit_test.h" | 14 #include "vm/unit_test.h" |
14 | 15 |
15 namespace dart { | 16 namespace dart { |
16 | 17 |
17 // Check if serialized and deserialized objects are equal. | 18 // Check if serialized and deserialized objects are equal. |
18 static bool Equals(const Object& expected, const Object& actual) { | 19 static bool Equals(const Object& expected, const Object& actual) { |
19 if (expected.IsNull()) { | 20 if (expected.IsNull()) { |
20 return actual.IsNull(); | 21 return actual.IsNull(); |
21 } | 22 } |
22 if (expected.IsSmi()) { | 23 if (expected.IsSmi()) { |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 " static s2() { return 'this is a \"string\" in the source'; }\n" | 725 " static s2() { return 'this is a \"string\" in the source'; }\n" |
725 " static s3() { return 'this is a \\\'string\\\' in \"the\" source'; }\n" | 726 " static s3() { return 'this is a \\\'string\\\' in \"the\" source'; }\n" |
726 " static s4() { return 'this \"is\" a \"string\" in \"the\" source'; }\n" | 727 " static s4() { return 'this \"is\" a \"string\" in \"the\" source'; }\n" |
727 "}\n"; | 728 "}\n"; |
728 | 729 |
729 String& url = String::Handle(String::New("dart-test:SerializeScript")); | 730 String& url = String::Handle(String::New("dart-test:SerializeScript")); |
730 String& source = String::Handle(String::New(kScriptChars)); | 731 String& source = String::Handle(String::New(kScriptChars)); |
731 Script& script = Script::Handle(Script::New(url, | 732 Script& script = Script::Handle(Script::New(url, |
732 source, | 733 source, |
733 RawScript::kSourceTag)); | 734 RawScript::kSourceTag)); |
734 const String& lib_url = String::Handle(String::NewSymbol("TestLib")); | 735 const String& lib_url = String::Handle(Symbols::New("TestLib")); |
735 Library& lib = Library::Handle(Library::New(lib_url)); | 736 Library& lib = Library::Handle(Library::New(lib_url)); |
736 lib.Register(); | 737 lib.Register(); |
737 EXPECT(CompilerTest::TestCompileScript(lib, script)); | 738 EXPECT(CompilerTest::TestCompileScript(lib, script)); |
738 | 739 |
739 // Write snapshot with object content. | 740 // Write snapshot with object content. |
740 uint8_t* buffer; | 741 uint8_t* buffer; |
741 SnapshotWriter writer(Snapshot::kScript, &buffer, &malloc_allocator); | 742 SnapshotWriter writer(Snapshot::kScript, &buffer, &malloc_allocator); |
742 writer.WriteObject(script.raw()); | 743 writer.WriteObject(script.raw()); |
743 writer.FinalizeBuffer(); | 744 writer.FinalizeBuffer(); |
744 | 745 |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1562 EXPECT(Dart_ErrorHasException(result)); | 1563 EXPECT(Dart_ErrorHasException(result)); |
1563 EXPECT_SUBSTRING("Exception: nulltruefalse1234563.14[]100123456789\n", | 1564 EXPECT_SUBSTRING("Exception: nulltruefalse1234563.14[]100123456789\n", |
1564 Dart_GetError(result)); | 1565 Dart_GetError(result)); |
1565 | 1566 |
1566 Dart_ExitScope(); | 1567 Dart_ExitScope(); |
1567 } | 1568 } |
1568 | 1569 |
1569 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 1570 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
1570 | 1571 |
1571 } // namespace dart | 1572 } // namespace dart |
OLD | NEW |