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

Side by Side Diff: tests/compiler/dart2js/incremental/hello_test.dart

Issue 1235563003: Add interfaces for a new compiler API. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Rebased Created 5 years, 5 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
OLDNEW
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 a sequence of modifications to hello-world which used to cause problems 5 // Test a sequence of modifications to hello-world which used to cause problems
6 // on Try Dart. 6 // on Try Dart.
7 7
8 import 'dart:io' show 8 import 'dart:io' show
9 Platform; 9 Platform;
10 10
11 import 'dart:async' show 11 import 'dart:async' show
12 Future; 12 Future;
13 13
14 import 'package:dart2js_incremental/dart2js_incremental.dart' show 14 import 'package:dart2js_incremental/dart2js_incremental.dart' show
15 IncrementalCompiler; 15 IncrementalCompiler;
16 16
17 import 'package:compiler/compiler.dart' show 17 import 'package:compiler/compiler.dart' show
18 Diagnostic; 18 Diagnostic;
19 19
20 import 'package:compiler/src/dart2jslib.dart' show 20 import 'package:compiler/src/null_compiler_output.dart' show
21 NullSink; 21 NullCompilerOutput;
22
23 import 'package:compiler/src/old_to_new_api.dart' show
24 LegacyCompilerDiagnostics;
22 25
23 import 'package:async_helper/async_helper.dart' show 26 import 'package:async_helper/async_helper.dart' show
24 asyncTest; 27 asyncTest;
25 28
26 import 'package:expect/expect.dart' show 29 import 'package:expect/expect.dart' show
27 Expect; 30 Expect;
28 31
29 import '../memory_source_file_helper.dart' show 32 import '../memory_source_file_helper.dart' show
30 MemorySourceFileProvider; 33 MemorySourceFileProvider;
31 34
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 MemorySourceFileProvider provider = 90 MemorySourceFileProvider provider =
88 new MemorySourceFileProvider(tests); 91 new MemorySourceFileProvider(tests);
89 asyncTest(() => runTests(libraryRoot, packageRoot, provider)); 92 asyncTest(() => runTests(libraryRoot, packageRoot, provider));
90 } 93 }
91 94
92 Future runTests( 95 Future runTests(
93 Uri libraryRoot, 96 Uri libraryRoot,
94 Uri packageRoot, 97 Uri packageRoot,
95 MemorySourceFileProvider provider) { 98 MemorySourceFileProvider provider) {
96 IncrementalCompiler compiler = new IncrementalCompiler( 99 IncrementalCompiler compiler = new IncrementalCompiler(
97 diagnosticHandler: handler, 100 diagnosticHandler: new LegacyCompilerDiagnostics(handler),
98 inputProvider: provider, 101 inputProvider: provider,
99 outputProvider: NullSink.outputProvider, 102 outputProvider: const NullCompilerOutput(),
100 options: ['--analyze-main'], 103 options: ['--analyze-main'],
101 libraryRoot: libraryRoot, 104 libraryRoot: libraryRoot,
102 packageRoot: packageRoot); 105 packageRoot: packageRoot);
103 106
104 return Future.forEach(tests.keys, (String testName) { 107 return Future.forEach(tests.keys, (String testName) {
105 Uri testUri = Uri.parse('memory:$testName'); 108 Uri testUri = Uri.parse('memory:$testName');
106 return compiler.compile(testUri).then((bool success) { 109 return compiler.compile(testUri).then((bool success) {
107 Expect.equals( 110 Expect.equals(
108 testResults[testName], success, 111 testResults[testName], success,
109 'Compilation unexpectedly ${success ? "succeed" : "failed"}.'); 112 'Compilation unexpectedly ${success ? "succeed" : "failed"}.');
110 }); 113 });
111 }); 114 });
112 } 115 }
113 116
114 void handler(Uri uri, 117 void handler(Uri uri,
115 int begin, 118 int begin,
116 int end, 119 int end,
117 String message, 120 String message,
118 Diagnostic kind) { 121 Diagnostic kind) {
119 if (kind != Diagnostic.VERBOSE_INFO) { 122 if (kind != Diagnostic.VERBOSE_INFO) {
120 print('$uri:$begin:$end:$message:$kind'); 123 print('$uri:$begin:$end:$message:$kind');
121 } 124 }
122 } 125 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/incremental/compile_all.dart ('k') | tests/compiler/dart2js/library_resolution_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698