| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library dart2js.test.uri_retention_test; | 5 library dart2js.test.uri_retention_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:expect/expect.dart'; | 9 import 'package:expect/expect.dart'; |
| 10 import "package:async_helper/async_helper.dart"; | 10 import "package:async_helper/async_helper.dart"; |
| 11 import 'package:compiler/compiler_new.dart'; |
| 11 | 12 |
| 12 import 'memory_compiler.dart' show runCompiler, OutputCollector; | 13 import 'memory_compiler.dart' show runCompiler, OutputCollector; |
| 13 | 14 |
| 14 Future<String> compileSources(sources, {bool minify, bool preserveUri}) async { | 15 Future<String> compileSources(sources, {bool minify, bool preserveUri}) async { |
| 15 var options = []; | 16 var options = []; |
| 16 if (minify) options.add("--minify"); | 17 if (minify) options.add("--minify"); |
| 17 if (preserveUri) options.add("--preserve-uris"); | 18 if (preserveUri) options.add("--preserve-uris"); |
| 18 OutputCollector outputCollector = new OutputCollector(); | 19 OutputCollector outputCollector = new OutputCollector(); |
| 19 await runCompiler( | 20 await runCompiler( |
| 20 memorySourceFiles: sources, | 21 memorySourceFiles: sources, |
| 21 options: options, | 22 options: options, |
| 22 outputProvider: outputCollector); | 23 outputProvider: outputCollector); |
| 23 return outputCollector.getOutput('', 'js'); | 24 return outputCollector.getOutput('', OutputType.js); |
| 24 } | 25 } |
| 25 | 26 |
| 26 Future test(sources, {bool libName, bool fileName}) { | 27 Future test(sources, {bool libName, bool fileName}) { |
| 27 return compileSources(sources, minify: false, preserveUri: false) | 28 return compileSources(sources, minify: false, preserveUri: false) |
| 28 .then((output) { | 29 .then((output) { |
| 29 // Unminified the sources should always contain the library name and the | 30 // Unminified the sources should always contain the library name and the |
| 30 // file name. | 31 // file name. |
| 31 Expect.isTrue(output.contains("main_lib")); | 32 Expect.isTrue(output.contains("main_lib")); |
| 32 Expect.isTrue(output.contains("main.dart")); | 33 Expect.isTrue(output.contains("main.dart")); |
| 33 }).then((_) { | 34 }).then((_) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 library main_lib; | 104 library main_lib; |
| 104 | 105 |
| 105 @MirrorsUsed(targets: 'main_lib') | 106 @MirrorsUsed(targets: 'main_lib') |
| 106 import 'dart:mirrors'; | 107 import 'dart:mirrors'; |
| 107 | 108 |
| 108 main() { | 109 main() { |
| 109 print(currentMirrorSystem().findLibrary(#main_lib).uri); | 110 print(currentMirrorSystem().findLibrary(#main_lib).uri); |
| 110 } | 111 } |
| 111 """, | 112 """, |
| 112 }; | 113 }; |
| OLD | NEW |