| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'package:expect/expect.dart'; | 5 import 'package:expect/expect.dart'; |
| 6 import "package:async_helper/async_helper.dart"; | 6 import "package:async_helper/async_helper.dart"; |
| 7 import 'memory_source_file_helper.dart'; | 7 import 'memory_source_file_helper.dart'; |
| 8 import "memory_compiler.dart"; | 8 import "memory_compiler.dart"; |
| 9 | 9 |
| 10 void main() { | 10 void main() { |
| 11 asyncTest(() async { | 11 asyncTest(() async { |
| 12 var collector = new OutputCollector(); | 12 var collector = new OutputCollector(); |
| 13 CompilationResult result = await runCompiler( | 13 CompilationResult result = await runCompiler( |
| 14 memorySourceFiles: MEMORY_SOURCE_FILES, | 14 memorySourceFiles: MEMORY_SOURCE_FILES, |
| 15 options: ['--deferred-map=deferred_map.json'], | 15 options: ['--deferred-map=deferred_map.json'], |
| 16 outputProvider: collector); | 16 outputProvider: collector); |
| 17 Compiler compiler = result.compiler; | 17 CompilerImpl compiler = result.compiler; |
| 18 // Ensure a mapping file is output. | 18 // Ensure a mapping file is output. |
| 19 Expect.isNotNull( | 19 Expect.isNotNull( |
| 20 collector.getOutput("deferred_map.json", "deferred_map")); | 20 collector.getOutput("deferred_map.json", "deferred_map")); |
| 21 | 21 |
| 22 Map mapping = compiler.deferredLoadTask.computeDeferredMap(); | 22 Map mapping = compiler.deferredLoadTask.computeDeferredMap(); |
| 23 // Test structure of mapping. | 23 // Test structure of mapping. |
| 24 Expect.equals("<unnamed>", mapping["main.dart"]["name"]); | 24 Expect.equals("<unnamed>", mapping["main.dart"]["name"]); |
| 25 Expect.equals(2, mapping["main.dart"]["imports"]["lib1"].length); | 25 Expect.equals(2, mapping["main.dart"]["imports"]["lib1"].length); |
| 26 Expect.equals(2, mapping["main.dart"]["imports"]["lib2"].length); | 26 Expect.equals(2, mapping["main.dart"]["imports"]["lib2"].length); |
| 27 Expect.equals(1, mapping["main.dart"]["imports"]["convert"].length); | 27 Expect.equals(1, mapping["main.dart"]["imports"]["convert"].length); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 bar1() { | 94 bar1() { |
| 95 return "hello"; | 95 return "hello"; |
| 96 } | 96 } |
| 97 | 97 |
| 98 bar2() { | 98 bar2() { |
| 99 return 2; | 99 return 2; |
| 100 } | 100 } |
| 101 """, | 101 """, |
| 102 }; | 102 }; |
| OLD | NEW |