| 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_api.h" | 5 #include "include/dart_api.h" |
| 6 #include "platform/assert.h" | 6 #include "platform/assert.h" |
| 7 #include "platform/utils.h" | 7 #include "platform/utils.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_state.h" | 10 #include "vm/dart_api_state.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 EXPECT(!Dart_ErrorHasException(instance)); | 39 EXPECT(!Dart_ErrorHasException(instance)); |
| 40 EXPECT(!Dart_ErrorHasException(error)); | 40 EXPECT(!Dart_ErrorHasException(error)); |
| 41 EXPECT(Dart_ErrorHasException(exception)); | 41 EXPECT(Dart_ErrorHasException(exception)); |
| 42 | 42 |
| 43 EXPECT_STREQ("", Dart_GetError(instance)); | 43 EXPECT_STREQ("", Dart_GetError(instance)); |
| 44 EXPECT_STREQ("myerror", Dart_GetError(error)); | 44 EXPECT_STREQ("myerror", Dart_GetError(error)); |
| 45 EXPECT_STREQ( | 45 EXPECT_STREQ( |
| 46 "Unhandled exception:\n" | 46 "Unhandled exception:\n" |
| 47 "Exception: bad news\n" | 47 "Exception: bad news\n" |
| 48 " 0. Function: '::testMain' url: 'dart:test-lib' line:2 col:3\n", | 48 " 0. Function: '::testMain' url: 'dart:test-lib' line:2 col:3", |
| 49 Dart_GetError(exception)); | 49 Dart_GetError(exception)); |
| 50 | 50 |
| 51 EXPECT(Dart_IsError(Dart_ErrorGetException(instance))); | 51 EXPECT(Dart_IsError(Dart_ErrorGetException(instance))); |
| 52 EXPECT(Dart_IsError(Dart_ErrorGetException(error))); | 52 EXPECT(Dart_IsError(Dart_ErrorGetException(error))); |
| 53 EXPECT_VALID(Dart_ErrorGetException(exception)); | 53 EXPECT_VALID(Dart_ErrorGetException(exception)); |
| 54 | 54 |
| 55 EXPECT(Dart_IsError(Dart_ErrorGetStacktrace(instance))); | 55 EXPECT(Dart_IsError(Dart_ErrorGetStacktrace(instance))); |
| 56 EXPECT(Dart_IsError(Dart_ErrorGetStacktrace(error))); | 56 EXPECT(Dart_IsError(Dart_ErrorGetStacktrace(error))); |
| 57 EXPECT_VALID(Dart_ErrorGetStacktrace(exception)); | 57 EXPECT_VALID(Dart_ErrorGetStacktrace(exception)); |
| 58 } | 58 } |
| (...skipping 4593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4652 source = Dart_NewString(kLibrary1Chars); | 4652 source = Dart_NewString(kLibrary1Chars); |
| 4653 Dart_LoadLibrary(url, source); | 4653 Dart_LoadLibrary(url, source); |
| 4654 | 4654 |
| 4655 url = Dart_NewString("library2.dart"); | 4655 url = Dart_NewString("library2.dart"); |
| 4656 source = Dart_NewString(kLibrary2Chars); | 4656 source = Dart_NewString(kLibrary2Chars); |
| 4657 Dart_LoadLibrary(url, source); | 4657 Dart_LoadLibrary(url, source); |
| 4658 | 4658 |
| 4659 result = Dart_Invoke(result, Dart_NewString("main"), 0, NULL); | 4659 result = Dart_Invoke(result, Dart_NewString("main"), 0, NULL); |
| 4660 EXPECT(Dart_IsError(result)); | 4660 EXPECT(Dart_IsError(result)); |
| 4661 EXPECT_STREQ("Duplicate definition : 'foo' is defined in" | 4661 EXPECT_STREQ("Duplicate definition : 'foo' is defined in" |
| 4662 " 'library2.dart' and 'dart:test-lib'\n", | 4662 " 'library2.dart' and 'dart:test-lib'", |
| 4663 Dart_GetError(result)); | 4663 Dart_GetError(result)); |
| 4664 } | 4664 } |
| 4665 | 4665 |
| 4666 | 4666 |
| 4667 TEST_CASE(ImportLibrary2) { | 4667 TEST_CASE(ImportLibrary2) { |
| 4668 const char* kScriptChars = | 4668 const char* kScriptChars = |
| 4669 "#import('library1.dart');" | 4669 "#import('library1.dart');" |
| 4670 "var foo;" | 4670 "var foo;" |
| 4671 "main() {}"; | 4671 "main() {}"; |
| 4672 const char* kLibrary1Chars = | 4672 const char* kLibrary1Chars = |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4723 source = Dart_NewString(kLibrary2Chars); | 4723 source = Dart_NewString(kLibrary2Chars); |
| 4724 Dart_LoadLibrary(url, source); | 4724 Dart_LoadLibrary(url, source); |
| 4725 | 4725 |
| 4726 url = Dart_NewString("library1.dart"); | 4726 url = Dart_NewString("library1.dart"); |
| 4727 source = Dart_NewString(kLibrary1Chars); | 4727 source = Dart_NewString(kLibrary1Chars); |
| 4728 Dart_LoadLibrary(url, source); | 4728 Dart_LoadLibrary(url, source); |
| 4729 | 4729 |
| 4730 result = Dart_Invoke(result, Dart_NewString("main"), 0, NULL); | 4730 result = Dart_Invoke(result, Dart_NewString("main"), 0, NULL); |
| 4731 EXPECT(Dart_IsError(result)); | 4731 EXPECT(Dart_IsError(result)); |
| 4732 EXPECT_STREQ("Duplicate definition : 'foo' is defined in" | 4732 EXPECT_STREQ("Duplicate definition : 'foo' is defined in" |
| 4733 " 'library2.dart' and 'library1.dart'\n", | 4733 " 'library2.dart' and 'library1.dart'", |
| 4734 Dart_GetError(result)); | 4734 Dart_GetError(result)); |
| 4735 } | 4735 } |
| 4736 | 4736 |
| 4737 | 4737 |
| 4738 TEST_CASE(ImportLibrary4) { | 4738 TEST_CASE(ImportLibrary4) { |
| 4739 const char* kScriptChars = | 4739 const char* kScriptChars = |
| 4740 "#import('libraryA.dart');" | 4740 "#import('libraryA.dart');" |
| 4741 "#import('libraryB.dart');" | 4741 "#import('libraryB.dart');" |
| 4742 "#import('libraryD.dart');" | 4742 "#import('libraryD.dart');" |
| 4743 "#import('libraryE.dart');" | 4743 "#import('libraryE.dart');" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4795 source = Dart_NewString(kLibraryFChars); | 4795 source = Dart_NewString(kLibraryFChars); |
| 4796 Dart_LoadLibrary(url, source); | 4796 Dart_LoadLibrary(url, source); |
| 4797 | 4797 |
| 4798 url = Dart_NewString("libraryE.dart"); | 4798 url = Dart_NewString("libraryE.dart"); |
| 4799 source = Dart_NewString(kLibraryEChars); | 4799 source = Dart_NewString(kLibraryEChars); |
| 4800 Dart_LoadLibrary(url, source); | 4800 Dart_LoadLibrary(url, source); |
| 4801 | 4801 |
| 4802 result = Dart_Invoke(result, Dart_NewString("main"), 0, NULL); | 4802 result = Dart_Invoke(result, Dart_NewString("main"), 0, NULL); |
| 4803 EXPECT(Dart_IsError(result)); | 4803 EXPECT(Dart_IsError(result)); |
| 4804 EXPECT_STREQ("Duplicate definition : 'fooC' is defined in" | 4804 EXPECT_STREQ("Duplicate definition : 'fooC' is defined in" |
| 4805 " 'libraryC.dart' and 'libraryF.dart'\n", | 4805 " 'libraryC.dart' and 'libraryF.dart'", |
| 4806 Dart_GetError(result)); | 4806 Dart_GetError(result)); |
| 4807 } | 4807 } |
| 4808 | 4808 |
| 4809 | 4809 |
| 4810 TEST_CASE(ImportLibrary5) { | 4810 TEST_CASE(ImportLibrary5) { |
| 4811 const char* kScriptChars = | 4811 const char* kScriptChars = |
| 4812 "#import('lib.dart');" | 4812 "#import('lib.dart');" |
| 4813 "interface Y {" | 4813 "interface Y {" |
| 4814 " void set handler(void callback(List<int> x));" | 4814 " void set handler(void callback(List<int> x));" |
| 4815 "}" | 4815 "}" |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5168 // We should have received the expected number of interrupts. | 5168 // We should have received the expected number of interrupts. |
| 5169 EXPECT_EQ(kInterruptCount, interrupt_count); | 5169 EXPECT_EQ(kInterruptCount, interrupt_count); |
| 5170 | 5170 |
| 5171 // Give the spawned thread enough time to properly exit. | 5171 // Give the spawned thread enough time to properly exit. |
| 5172 Isolate::SetInterruptCallback(saved); | 5172 Isolate::SetInterruptCallback(saved); |
| 5173 } | 5173 } |
| 5174 | 5174 |
| 5175 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 5175 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
| 5176 | 5176 |
| 5177 } // namespace dart | 5177 } // namespace dart |
| OLD | NEW |