| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // Test that the additional runtime type support is output to the right | 5 // Test that the additional runtime type support is output to the right |
| 6 // Files when using deferred loading. | 6 // Files when using deferred loading. |
| 7 | 7 |
| 8 import 'package:async_helper/async_helper.dart'; | 8 import 'package:async_helper/async_helper.dart'; |
| 9 import 'package:compiler/compiler_new.dart'; |
| 9 import 'package:compiler/src/compiler.dart'; | 10 import 'package:compiler/src/compiler.dart'; |
| 10 import 'package:expect/expect.dart'; | 11 import 'package:expect/expect.dart'; |
| 11 import 'memory_compiler.dart'; | 12 import 'memory_compiler.dart'; |
| 12 import 'output_collector.dart'; | 13 import 'output_collector.dart'; |
| 13 | 14 |
| 14 void main() { | 15 void main() { |
| 15 asyncTest(() async { | 16 asyncTest(() async { |
| 16 OutputCollector collector = new OutputCollector(); | 17 OutputCollector collector = new OutputCollector(); |
| 17 CompilationResult result = await runCompiler( | 18 CompilationResult result = await runCompiler( |
| 18 memorySourceFiles: MEMORY_SOURCE_FILES, outputProvider: collector); | 19 memorySourceFiles: MEMORY_SOURCE_FILES, outputProvider: collector); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 32 var foo1 = lib1.find("foo"); | 33 var foo1 = lib1.find("foo"); |
| 33 var ou_lib1 = outputUnitForElement(foo1); | 34 var ou_lib1 = outputUnitForElement(foo1); |
| 34 | 35 |
| 35 var lib2 = lookupLibrary("memory:lib2.dart"); | 36 var lib2 = lookupLibrary("memory:lib2.dart"); |
| 36 var foo2 = lib2.find("foo"); | 37 var foo2 = lib2.find("foo"); |
| 37 var ou_lib2 = outputUnitForElement(foo2); | 38 var ou_lib2 = outputUnitForElement(foo2); |
| 38 | 39 |
| 39 var fooMain = compiler.mainApp.find("foo"); | 40 var fooMain = compiler.mainApp.find("foo"); |
| 40 var ou_lib1_lib2 = outputUnitForElement(fooMain); | 41 var ou_lib1_lib2 = outputUnitForElement(fooMain); |
| 41 | 42 |
| 42 String mainOutput = collector.getOutput("", "js"); | 43 String mainOutput = collector.getOutput("", OutputType.js); |
| 43 String lib1Output = collector.getOutput("out_${ou_lib1.name}", "part.js"); | 44 String lib1Output = |
| 44 String lib2Output = collector.getOutput("out_${ou_lib2.name}", "part.js"); | 45 collector.getOutput("out_${ou_lib1.name}", OutputType.jsPart); |
| 46 String lib2Output = |
| 47 collector.getOutput("out_${ou_lib2.name}", OutputType.jsPart); |
| 45 String lib12Output = | 48 String lib12Output = |
| 46 collector.getOutput("out_${ou_lib1_lib2.name}", "part.js"); | 49 collector.getOutput("out_${ou_lib1_lib2.name}", OutputType.jsPart); |
| 47 // Test that the deferred constants are not inlined into the main file. | 50 // Test that the deferred constants are not inlined into the main file. |
| 48 RegExp re1 = new RegExp(r"= .string1"); | 51 RegExp re1 = new RegExp(r"= .string1"); |
| 49 RegExp re2 = new RegExp(r"= .string2"); | 52 RegExp re2 = new RegExp(r"= .string2"); |
| 50 RegExp re3 = new RegExp(r"= 1010"); | 53 RegExp re3 = new RegExp(r"= 1010"); |
| 51 Expect.isTrue(re1.hasMatch(lib1Output)); | 54 Expect.isTrue(re1.hasMatch(lib1Output)); |
| 52 Expect.isTrue(re2.hasMatch(lib1Output)); | 55 Expect.isTrue(re2.hasMatch(lib1Output)); |
| 53 Expect.isTrue(re3.hasMatch(lib1Output)); | 56 Expect.isTrue(re3.hasMatch(lib1Output)); |
| 54 Expect.isFalse(re1.hasMatch(mainOutput)); | 57 Expect.isFalse(re1.hasMatch(mainOutput)); |
| 55 Expect.isFalse(re2.hasMatch(mainOutput)); | 58 Expect.isFalse(re2.hasMatch(mainOutput)); |
| 56 Expect.isFalse(re3.hasMatch(mainOutput)); | 59 Expect.isFalse(re3.hasMatch(mainOutput)); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 import "main.dart" as main; | 142 import "main.dart" as main; |
| 140 const C4 = "string4"; | 143 const C4 = "string4"; |
| 141 const C5 = const main.C(1); | 144 const C5 = const main.C(1); |
| 142 const C6 = const main.C(2); | 145 const C6 = const main.C(2); |
| 143 foo() { | 146 foo() { |
| 144 print("lib2"); | 147 print("lib2"); |
| 145 main.foo(); | 148 main.foo(); |
| 146 } | 149 } |
| 147 """ | 150 """ |
| 148 }; | 151 }; |
| OLD | NEW |