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 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 |
| 21 NullSink; |
| 22 |
20 import 'package:async_helper/async_helper.dart' show | 23 import 'package:async_helper/async_helper.dart' show |
21 asyncTest; | 24 asyncTest; |
22 | 25 |
23 import 'package:expect/expect.dart' show | 26 import 'package:expect/expect.dart' show |
24 Expect; | 27 Expect; |
25 | 28 |
26 import '../memory_source_file_helper.dart' show | 29 import '../memory_source_file_helper.dart' show |
27 MemorySourceFileProvider; | 30 MemorySourceFileProvider; |
28 | 31 |
29 var tests = { | 32 var tests = { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 asyncTest(() => runTests(libraryRoot, packageRoot, provider)); | 89 asyncTest(() => runTests(libraryRoot, packageRoot, provider)); |
87 } | 90 } |
88 | 91 |
89 Future runTests( | 92 Future runTests( |
90 Uri libraryRoot, | 93 Uri libraryRoot, |
91 Uri packageRoot, | 94 Uri packageRoot, |
92 MemorySourceFileProvider provider) { | 95 MemorySourceFileProvider provider) { |
93 IncrementalCompiler compiler = new IncrementalCompiler( | 96 IncrementalCompiler compiler = new IncrementalCompiler( |
94 diagnosticHandler: handler, | 97 diagnosticHandler: handler, |
95 inputProvider: provider, | 98 inputProvider: provider, |
| 99 outputProvider: NullSink.outputProvider, |
96 options: ['--analyze-main'], | 100 options: ['--analyze-main'], |
97 libraryRoot: libraryRoot, | 101 libraryRoot: libraryRoot, |
98 packageRoot: packageRoot); | 102 packageRoot: packageRoot); |
99 | 103 |
100 return Future.forEach(tests.keys, (String testName) { | 104 return Future.forEach(tests.keys, (String testName) { |
101 Uri testUri = Uri.parse('memory:$testName'); | 105 Uri testUri = Uri.parse('memory:$testName'); |
102 return compiler.compile(testUri).then((bool success) { | 106 return compiler.compile(testUri).then((bool success) { |
103 Expect.equals( | 107 Expect.equals( |
104 testResults[testName], success, | 108 testResults[testName], success, |
105 'Compilation unexpectedly ${success ? "succeed" : "failed"}.'); | 109 'Compilation unexpectedly ${success ? "succeed" : "failed"}.'); |
106 }); | 110 }); |
107 }); | 111 }); |
108 } | 112 } |
109 | 113 |
110 void handler(Uri uri, | 114 void handler(Uri uri, |
111 int begin, | 115 int begin, |
112 int end, | 116 int end, |
113 String message, | 117 String message, |
114 Diagnostic kind) { | 118 Diagnostic kind) { |
115 if (kind != Diagnostic.VERBOSE_INFO) { | 119 if (kind != Diagnostic.VERBOSE_INFO) { |
116 print('$uri:$begin:$end:$message:$kind'); | 120 print('$uri:$begin:$end:$message:$kind'); |
117 } | 121 } |
118 } | 122 } |
OLD | NEW |