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" |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 CheckBigint("0x9876543210987654321098765432109876543210"); | 466 CheckBigint("0x9876543210987654321098765432109876543210"); |
467 CheckBigint("-0x9876543210987654321098765432109876543210"); | 467 CheckBigint("-0x9876543210987654321098765432109876543210"); |
468 } | 468 } |
469 | 469 |
470 TEST_CASE(SerializeSingletons) { | 470 TEST_CASE(SerializeSingletons) { |
471 // Write snapshot with object content. | 471 // Write snapshot with object content. |
472 uint8_t* buffer; | 472 uint8_t* buffer; |
473 MessageWriter writer(&buffer, &malloc_allocator); | 473 MessageWriter writer(&buffer, &malloc_allocator); |
474 writer.WriteObject(Object::class_class()); | 474 writer.WriteObject(Object::class_class()); |
475 writer.WriteObject(Object::type_arguments_class()); | 475 writer.WriteObject(Object::type_arguments_class()); |
476 writer.WriteObject(Object::instantiated_type_arguments_class()); | |
477 writer.WriteObject(Object::function_class()); | 476 writer.WriteObject(Object::function_class()); |
478 writer.WriteObject(Object::field_class()); | 477 writer.WriteObject(Object::field_class()); |
479 writer.WriteObject(Object::token_stream_class()); | 478 writer.WriteObject(Object::token_stream_class()); |
480 writer.WriteObject(Object::script_class()); | 479 writer.WriteObject(Object::script_class()); |
481 writer.WriteObject(Object::library_class()); | 480 writer.WriteObject(Object::library_class()); |
482 writer.WriteObject(Object::code_class()); | 481 writer.WriteObject(Object::code_class()); |
483 writer.WriteObject(Object::instructions_class()); | 482 writer.WriteObject(Object::instructions_class()); |
484 writer.WriteObject(Object::pc_descriptors_class()); | 483 writer.WriteObject(Object::pc_descriptors_class()); |
485 writer.WriteObject(Object::exception_handlers_class()); | 484 writer.WriteObject(Object::exception_handlers_class()); |
486 writer.WriteObject(Object::context_class()); | 485 writer.WriteObject(Object::context_class()); |
487 writer.WriteObject(Object::context_scope_class()); | 486 writer.WriteObject(Object::context_scope_class()); |
488 intptr_t buffer_len = writer.BytesWritten(); | 487 intptr_t buffer_len = writer.BytesWritten(); |
489 | 488 |
490 // Read object back from the snapshot. | 489 // Read object back from the snapshot. |
491 SnapshotReader reader(buffer, buffer_len, Snapshot::kMessage, | 490 SnapshotReader reader(buffer, buffer_len, Snapshot::kMessage, |
492 Isolate::Current()); | 491 Isolate::Current()); |
493 EXPECT(Object::class_class() == reader.ReadObject()); | 492 EXPECT(Object::class_class() == reader.ReadObject()); |
494 EXPECT(Object::type_arguments_class() == reader.ReadObject()); | 493 EXPECT(Object::type_arguments_class() == reader.ReadObject()); |
495 EXPECT(Object::instantiated_type_arguments_class() == reader.ReadObject()); | |
496 EXPECT(Object::function_class() == reader.ReadObject()); | 494 EXPECT(Object::function_class() == reader.ReadObject()); |
497 EXPECT(Object::field_class() == reader.ReadObject()); | 495 EXPECT(Object::field_class() == reader.ReadObject()); |
498 EXPECT(Object::token_stream_class() == reader.ReadObject()); | 496 EXPECT(Object::token_stream_class() == reader.ReadObject()); |
499 EXPECT(Object::script_class() == reader.ReadObject()); | 497 EXPECT(Object::script_class() == reader.ReadObject()); |
500 EXPECT(Object::library_class() == reader.ReadObject()); | 498 EXPECT(Object::library_class() == reader.ReadObject()); |
501 EXPECT(Object::code_class() == reader.ReadObject()); | 499 EXPECT(Object::code_class() == reader.ReadObject()); |
502 EXPECT(Object::instructions_class() == reader.ReadObject()); | 500 EXPECT(Object::instructions_class() == reader.ReadObject()); |
503 EXPECT(Object::pc_descriptors_class() == reader.ReadObject()); | 501 EXPECT(Object::pc_descriptors_class() == reader.ReadObject()); |
504 EXPECT(Object::exception_handlers_class() == reader.ReadObject()); | 502 EXPECT(Object::exception_handlers_class() == reader.ReadObject()); |
505 EXPECT(Object::context_class() == reader.ReadObject()); | 503 EXPECT(Object::context_class() == reader.ReadObject()); |
(...skipping 2181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2687 result = Dart_RunLoop(); | 2685 result = Dart_RunLoop(); |
2688 EXPECT(Dart_IsError(result)); | 2686 EXPECT(Dart_IsError(result)); |
2689 EXPECT(Dart_ErrorHasException(result)); | 2687 EXPECT(Dart_ErrorHasException(result)); |
2690 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n", | 2688 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n", |
2691 Dart_GetError(result)); | 2689 Dart_GetError(result)); |
2692 | 2690 |
2693 Dart_ExitScope(); | 2691 Dart_ExitScope(); |
2694 } | 2692 } |
2695 | 2693 |
2696 } // namespace dart | 2694 } // namespace dart |
OLD | NEW |