OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 "include/dart_tools_api.h" | 6 #include "include/dart_tools_api.h" |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
10 #include "vm/lockers.h" | 10 #include "vm/lockers.h" |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 | 306 |
307 | 307 |
308 TEST_CASE(IsolateReload_LibraryImportAdded) { | 308 TEST_CASE(IsolateReload_LibraryImportAdded) { |
309 const char* kScript = | 309 const char* kScript = |
310 "main() {\n" | 310 "main() {\n" |
311 " return max(3, 4);\n" | 311 " return max(3, 4);\n" |
312 "}\n"; | 312 "}\n"; |
313 | 313 |
314 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); | 314 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); |
315 EXPECT_VALID(lib); | 315 EXPECT_VALID(lib); |
316 EXPECT_ERROR(SimpleInvokeError(lib, "main"), "max");; | 316 EXPECT_ERROR(SimpleInvokeError(lib, "main"), "max"); |
317 | 317 |
318 const char* kReloadScript = | 318 const char* kReloadScript = |
319 "import 'dart:math';\n" | 319 "import 'dart:math';\n" |
320 "main() {\n" | 320 "main() {\n" |
321 " return max(3, 4);\n" | 321 " return max(3, 4);\n" |
322 "}\n"; | 322 "}\n"; |
323 | 323 |
324 lib = TestCase::ReloadTestScript(kReloadScript); | 324 lib = TestCase::ReloadTestScript(kReloadScript); |
325 EXPECT_VALID(lib); | 325 EXPECT_VALID(lib); |
326 EXPECT_EQ(4, SimpleInvoke(lib, "main")); | 326 EXPECT_EQ(4, SimpleInvoke(lib, "main")); |
(...skipping 12 matching lines...) Expand all Loading... |
339 EXPECT_EQ(4, SimpleInvoke(lib, "main")); | 339 EXPECT_EQ(4, SimpleInvoke(lib, "main")); |
340 | 340 |
341 const char* kReloadScript = | 341 const char* kReloadScript = |
342 "main() {\n" | 342 "main() {\n" |
343 " return max(3, 4);\n" | 343 " return max(3, 4);\n" |
344 "}\n"; | 344 "}\n"; |
345 | 345 |
346 lib = TestCase::ReloadTestScript(kReloadScript); | 346 lib = TestCase::ReloadTestScript(kReloadScript); |
347 EXPECT_VALID(lib); | 347 EXPECT_VALID(lib); |
348 | 348 |
349 EXPECT_ERROR(SimpleInvokeError(lib, "main"), "max");; | 349 EXPECT_ERROR(SimpleInvokeError(lib, "main"), "max"); |
350 } | 350 } |
351 | 351 |
352 | 352 |
353 TEST_CASE(IsolateReload_LibraryDebuggable) { | 353 TEST_CASE(IsolateReload_LibraryDebuggable) { |
354 const char* kScript = | 354 const char* kScript = |
355 "main() {\n" | 355 "main() {\n" |
356 " return 1;\n" | 356 " return 1;\n" |
357 "}\n"; | 357 "}\n"; |
358 | 358 |
359 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); | 359 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); |
(...skipping 2719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3079 EXPECT_VALID(lib); | 3079 EXPECT_VALID(lib); |
3080 Dart_SetFileModifiedCallback(NULL); | 3080 Dart_SetFileModifiedCallback(NULL); |
3081 | 3081 |
3082 // Modification of an exported library propagates. | 3082 // Modification of an exported library propagates. |
3083 EXPECT_STREQ("bossy pants", SimpleInvokeStr(lib, "main")); | 3083 EXPECT_STREQ("bossy pants", SimpleInvokeStr(lib, "main")); |
3084 } | 3084 } |
3085 | 3085 |
3086 #endif // !PRODUCT | 3086 #endif // !PRODUCT |
3087 | 3087 |
3088 } // namespace dart | 3088 } // namespace dart |
OLD | NEW |