| 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 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_compiler.dart' show runCompiler, OutputCollector; | 8 import 'memory_compiler.dart' show runCompiler, OutputCollector; |
| 8 | 9 |
| 9 const MEMORY_SOURCE_FILES = const <String, String>{ | 10 const MEMORY_SOURCE_FILES = const <String, String>{ |
| 10 'main.dart': """ | 11 'main.dart': """ |
| 11 library main; | 12 library main; |
| 12 | 13 |
| 13 @MirrorsUsed(targets: const ['main', 'lib']) | 14 @MirrorsUsed(targets: const ['main', 'lib']) |
| 14 import 'dart:mirrors'; | 15 import 'dart:mirrors'; |
| 15 import 'lib.dart'; | 16 import 'lib.dart'; |
| 16 | 17 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 38 }; | 39 }; |
| 39 | 40 |
| 40 runTest(bool preserveUris) async { | 41 runTest(bool preserveUris) async { |
| 41 OutputCollector collector = new OutputCollector(); | 42 OutputCollector collector = new OutputCollector(); |
| 42 var options = ["--minify"]; | 43 var options = ["--minify"]; |
| 43 if (preserveUris) options.add("--preserve-uris"); | 44 if (preserveUris) options.add("--preserve-uris"); |
| 44 await runCompiler( | 45 await runCompiler( |
| 45 memorySourceFiles: MEMORY_SOURCE_FILES, | 46 memorySourceFiles: MEMORY_SOURCE_FILES, |
| 46 outputProvider: collector, | 47 outputProvider: collector, |
| 47 options: options); | 48 options: options); |
| 48 String jsOutput = collector.getOutput('', 'js'); | 49 String jsOutput = collector.getOutput('', OutputType.js); |
| 49 Expect.equals(preserveUris, jsOutput.contains("main.dart")); | 50 Expect.equals(preserveUris, jsOutput.contains("main.dart")); |
| 50 Expect.equals(preserveUris, jsOutput.contains("lib.dart")); | 51 Expect.equals(preserveUris, jsOutput.contains("lib.dart")); |
| 51 } | 52 } |
| 52 | 53 |
| 53 void main() { | 54 void main() { |
| 54 asyncTest(() async { | 55 asyncTest(() async { |
| 55 await runTest(true); | 56 await runTest(true); |
| 56 await runTest(false); | 57 await runTest(false); |
| 57 }); | 58 }); |
| 58 } | 59 } |
| OLD | NEW |