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 4233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4244 source = Dart_NewString(kLibrary2Chars); | 4244 source = Dart_NewString(kLibrary2Chars); |
4245 Dart_LoadLibrary(url, source, import_map); | 4245 Dart_LoadLibrary(url, source, import_map); |
4246 | 4246 |
4247 url = Dart_NewString("library1.dart"); | 4247 url = Dart_NewString("library1.dart"); |
4248 source = Dart_NewString(kLibrary1Chars); | 4248 source = Dart_NewString(kLibrary1Chars); |
4249 Dart_LoadLibrary(url, source, import_map); | 4249 Dart_LoadLibrary(url, source, import_map); |
4250 | 4250 |
4251 result = Dart_Invoke(result, Dart_NewString("main"), 0, NULL); | 4251 result = Dart_Invoke(result, Dart_NewString("main"), 0, NULL); |
4252 EXPECT(Dart_IsError(result)); | 4252 EXPECT(Dart_IsError(result)); |
4253 EXPECT_STREQ("Duplicate definition : 'foo' is defined in" | 4253 EXPECT_STREQ("Duplicate definition : 'foo' is defined in" |
4254 " 'library1.dart' and 'library2.dart'\n", | 4254 " 'library2.dart' and 'library1.dart'\n", |
4255 Dart_GetError(result)); | 4255 Dart_GetError(result)); |
4256 } | 4256 } |
4257 | 4257 |
4258 | 4258 |
4259 TEST_CASE(ImportLibrary4) { | 4259 TEST_CASE(ImportLibrary4) { |
4260 const char* kScriptChars = | 4260 const char* kScriptChars = |
4261 "#import('libraryA.dart');" | 4261 "#import('libraryA.dart');" |
4262 "#import('libraryB.dart');" | 4262 "#import('libraryB.dart');" |
4263 "#import('libraryD.dart');" | 4263 "#import('libraryD.dart');" |
4264 "#import('libraryE.dart');" | 4264 "#import('libraryE.dart');" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4317 source = Dart_NewString(kLibraryFChars); | 4317 source = Dart_NewString(kLibraryFChars); |
4318 Dart_LoadLibrary(url, source, import_map); | 4318 Dart_LoadLibrary(url, source, import_map); |
4319 | 4319 |
4320 url = Dart_NewString("libraryE.dart"); | 4320 url = Dart_NewString("libraryE.dart"); |
4321 source = Dart_NewString(kLibraryEChars); | 4321 source = Dart_NewString(kLibraryEChars); |
4322 Dart_LoadLibrary(url, source, import_map); | 4322 Dart_LoadLibrary(url, source, import_map); |
4323 | 4323 |
4324 result = Dart_Invoke(result, Dart_NewString("main"), 0, NULL); | 4324 result = Dart_Invoke(result, Dart_NewString("main"), 0, NULL); |
4325 EXPECT(Dart_IsError(result)); | 4325 EXPECT(Dart_IsError(result)); |
4326 EXPECT_STREQ("Duplicate definition : 'fooC' is defined in" | 4326 EXPECT_STREQ("Duplicate definition : 'fooC' is defined in" |
4327 " 'libraryF.dart' and 'libraryC.dart'\n", | 4327 " 'libraryC.dart' and 'libraryF.dart'\n", |
4328 Dart_GetError(result)); | 4328 Dart_GetError(result)); |
4329 } | 4329 } |
4330 | 4330 |
4331 | 4331 |
4332 TEST_CASE(ImportLibrary5) { | 4332 TEST_CASE(ImportLibrary5) { |
4333 const char* kScriptChars = | 4333 const char* kScriptChars = |
4334 "#import('lib.dart');" | 4334 "#import('lib.dart');" |
4335 "interface Y {" | 4335 "interface Y {" |
4336 " void set handler(void callback(List<int> x));" | 4336 " void set handler(void callback(List<int> x));" |
4337 "}" | 4337 "}" |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4691 // We should have received the expected number of interrupts. | 4691 // We should have received the expected number of interrupts. |
4692 EXPECT_EQ(kInterruptCount, interrupt_count); | 4692 EXPECT_EQ(kInterruptCount, interrupt_count); |
4693 | 4693 |
4694 // Give the spawned thread enough time to properly exit. | 4694 // Give the spawned thread enough time to properly exit. |
4695 Isolate::SetInterruptCallback(saved); | 4695 Isolate::SetInterruptCallback(saved); |
4696 } | 4696 } |
4697 | 4697 |
4698 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 4698 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
4699 | 4699 |
4700 } // namespace dart | 4700 } // namespace dart |
OLD | NEW |