Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: tests/compiler/dart2js/uri_retention_test.dart

Issue 832363002: Remove Compiler.assembledCode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 11
12 import 'memory_compiler.dart' show 12 import 'memory_compiler.dart' show
13 compilerFor; 13 compilerFor, OutputCollector;
14 14
15 Future<String> compileSources(sources, {bool minify, bool preserveUri}) { 15 Future<String> compileSources(sources, {bool minify, bool preserveUri}) {
16 var options = []; 16 var options = [];
17 if (minify) options.add("--minify"); 17 if (minify) options.add("--minify");
18 if (preserveUri) options.add("--preserve-uris"); 18 if (preserveUri) options.add("--preserve-uris");
19 var compiler = compilerFor(sources, options: options); 19 OutputCollector outputCollector = new OutputCollector();
20 var compiler = compilerFor(
21 sources, options: options, outputProvider: outputCollector);
20 return compiler.runCompiler(Uri.parse('memory:main.dart')).then((_) { 22 return compiler.runCompiler(Uri.parse('memory:main.dart')).then((_) {
21 return compiler.assembledCode; 23 return outputCollector.getOutput('', 'js');
22 }); 24 });
23 } 25 }
24 26
25 Future test(sources, { bool libName, bool fileName }) { 27 Future test(sources, { bool libName, bool fileName }) {
26 return 28 return
27 compileSources(sources, minify: false, preserveUri: false).then((output) { 29 compileSources(sources, minify: false, preserveUri: false).then((output) {
28 // Unminified the sources should always contain the library name and the 30 // Unminified the sources should always contain the library name and the
29 // file name. 31 // file name.
30 Expect.isTrue(output.contains("main_lib")); 32 Expect.isTrue(output.contains("main_lib"));
31 Expect.isTrue(output.contains("main.dart")); 33 Expect.isTrue(output.contains("main.dart"));
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 library main_lib; 104 library main_lib;
103 105
104 @MirrorsUsed(targets: 'main_lib') 106 @MirrorsUsed(targets: 'main_lib')
105 import 'dart:mirrors'; 107 import 'dart:mirrors';
106 108
107 main() { 109 main() {
108 print(currentMirrorSystem().findLibrary(#main_lib).uri); 110 print(currentMirrorSystem().findLibrary(#main_lib).uri);
109 } 111 }
110 """, 112 """,
111 }; 113 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698