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 4222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4233 source = Dart_NewString(kLibrary2Chars); | 4233 source = Dart_NewString(kLibrary2Chars); |
4234 Dart_LoadLibrary(url, source); | 4234 Dart_LoadLibrary(url, source); |
4235 | 4235 |
4236 url = Dart_NewString("library1.dart"); | 4236 url = Dart_NewString("library1.dart"); |
4237 source = Dart_NewString(kLibrary1Chars); | 4237 source = Dart_NewString(kLibrary1Chars); |
4238 Dart_LoadLibrary(url, source); | 4238 Dart_LoadLibrary(url, source); |
4239 | 4239 |
4240 result = Dart_Invoke(result, Dart_NewString("main"), 0, NULL); | 4240 result = Dart_Invoke(result, Dart_NewString("main"), 0, NULL); |
4241 EXPECT(Dart_IsError(result)); | 4241 EXPECT(Dart_IsError(result)); |
4242 EXPECT_STREQ("Duplicate definition : 'foo' is defined in" | 4242 EXPECT_STREQ("Duplicate definition : 'foo' is defined in" |
4243 " 'library1.dart' and 'library2.dart'\n", | 4243 " 'library2.dart' and 'library1.dart'\n", |
4244 Dart_GetError(result)); | 4244 Dart_GetError(result)); |
4245 } | 4245 } |
4246 | 4246 |
4247 | 4247 |
4248 TEST_CASE(ImportLibrary4) { | 4248 TEST_CASE(ImportLibrary4) { |
4249 const char* kScriptChars = | 4249 const char* kScriptChars = |
4250 "#import('libraryA.dart');" | 4250 "#import('libraryA.dart');" |
4251 "#import('libraryB.dart');" | 4251 "#import('libraryB.dart');" |
4252 "#import('libraryD.dart');" | 4252 "#import('libraryD.dart');" |
4253 "#import('libraryE.dart');" | 4253 "#import('libraryE.dart');" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4305 source = Dart_NewString(kLibraryFChars); | 4305 source = Dart_NewString(kLibraryFChars); |
4306 Dart_LoadLibrary(url, source); | 4306 Dart_LoadLibrary(url, source); |
4307 | 4307 |
4308 url = Dart_NewString("libraryE.dart"); | 4308 url = Dart_NewString("libraryE.dart"); |
4309 source = Dart_NewString(kLibraryEChars); | 4309 source = Dart_NewString(kLibraryEChars); |
4310 Dart_LoadLibrary(url, source); | 4310 Dart_LoadLibrary(url, source); |
4311 | 4311 |
4312 result = Dart_Invoke(result, Dart_NewString("main"), 0, NULL); | 4312 result = Dart_Invoke(result, Dart_NewString("main"), 0, NULL); |
4313 EXPECT(Dart_IsError(result)); | 4313 EXPECT(Dart_IsError(result)); |
4314 EXPECT_STREQ("Duplicate definition : 'fooC' is defined in" | 4314 EXPECT_STREQ("Duplicate definition : 'fooC' is defined in" |
4315 " 'libraryF.dart' and 'libraryC.dart'\n", | 4315 " 'libraryC.dart' and 'libraryF.dart'\n", |
4316 Dart_GetError(result)); | 4316 Dart_GetError(result)); |
4317 } | 4317 } |
4318 | 4318 |
4319 | 4319 |
4320 TEST_CASE(ImportLibrary5) { | 4320 TEST_CASE(ImportLibrary5) { |
4321 const char* kScriptChars = | 4321 const char* kScriptChars = |
4322 "#import('lib.dart');" | 4322 "#import('lib.dart');" |
4323 "interface Y {" | 4323 "interface Y {" |
4324 " void set handler(void callback(List<int> x));" | 4324 " void set handler(void callback(List<int> x));" |
4325 "}" | 4325 "}" |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4678 // We should have received the expected number of interrupts. | 4678 // We should have received the expected number of interrupts. |
4679 EXPECT_EQ(kInterruptCount, interrupt_count); | 4679 EXPECT_EQ(kInterruptCount, interrupt_count); |
4680 | 4680 |
4681 // Give the spawned thread enough time to properly exit. | 4681 // Give the spawned thread enough time to properly exit. |
4682 Isolate::SetInterruptCallback(saved); | 4682 Isolate::SetInterruptCallback(saved); |
4683 } | 4683 } |
4684 | 4684 |
4685 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 4685 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
4686 | 4686 |
4687 } // namespace dart | 4687 } // namespace dart |
OLD | NEW |