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