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 // Test the exit code of dart2js in case of exceptions, errors, warnings, etc. | 5 // Test the exit code of dart2js in case of exceptions, errors, warnings, etc. |
6 | 6 |
7 | 7 |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:io' show Platform; | 9 import 'dart:io' show Platform; |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 final String testType; | 27 final String testType; |
28 final Function onTest; | 28 final Function onTest; |
29 | 29 |
30 TestCompiler(api.CompilerInputProvider inputProvider, | 30 TestCompiler(api.CompilerInputProvider inputProvider, |
31 api.CompilerOutputProvider outputProvider, | 31 api.CompilerOutputProvider outputProvider, |
32 api.DiagnosticHandler handler, | 32 api.DiagnosticHandler handler, |
33 Uri libraryRoot, | 33 Uri libraryRoot, |
34 Uri packageRoot, | 34 Uri packageRoot, |
35 List<String> options, | 35 List<String> options, |
36 Map<String, dynamic> environment, | 36 Map<String, dynamic> environment, |
| 37 Uri packageConfig, |
| 38 api.PackagesDiscoveryProvider findPackages, |
37 String this.testMarker, | 39 String this.testMarker, |
38 String this.testType, | 40 String this.testType, |
39 Function this.onTest) | 41 Function this.onTest) |
40 : super(inputProvider, outputProvider, handler, libraryRoot, | 42 : super(inputProvider, outputProvider, handler, libraryRoot, |
41 packageRoot, options, environment) { | 43 packageRoot, options, environment, packageConfig, findPackages) { |
42 scanner = new TestScanner(this); | 44 scanner = new TestScanner(this); |
43 resolver = new TestResolver(this, backend.constantCompilerTask); | 45 resolver = new TestResolver(this, backend.constantCompilerTask); |
44 test('Compiler'); | 46 test('Compiler'); |
45 } | 47 } |
46 | 48 |
47 Future<bool> run(Uri uri) { | 49 Future<bool> run(Uri uri) { |
48 test('Compiler.run'); | 50 test('Compiler.run'); |
49 return super.run(uri); | 51 return super.run(uri); |
50 } | 52 } |
51 | 53 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 } | 151 } |
150 return new Future(() { | 152 return new Future(() { |
151 Future<api.CompilationResult> compile( | 153 Future<api.CompilationResult> compile( |
152 Uri script, | 154 Uri script, |
153 Uri libraryRoot, | 155 Uri libraryRoot, |
154 Uri packageRoot, | 156 Uri packageRoot, |
155 api.CompilerInputProvider inputProvider, | 157 api.CompilerInputProvider inputProvider, |
156 api.DiagnosticHandler handler, | 158 api.DiagnosticHandler handler, |
157 [List<String> options = const [], | 159 [List<String> options = const [], |
158 api.CompilerOutputProvider outputProvider, | 160 api.CompilerOutputProvider outputProvider, |
159 Map<String, dynamic> environment = const {}]) { | 161 Map<String, dynamic> environment = const {}, |
| 162 Uri packageConfig, |
| 163 api.PackagesDiscoveryProvider findPackages]) { |
160 libraryRoot = Platform.script.resolve('../../../sdk/'); | 164 libraryRoot = Platform.script.resolve('../../../sdk/'); |
161 outputProvider = NullSink.outputProvider; | 165 outputProvider = NullSink.outputProvider; |
162 // Use this to silence the test when debugging: | 166 // Use this to silence the test when debugging: |
163 // handler = (uri, begin, end, message, kind) {}; | 167 // handler = (uri, begin, end, message, kind) {}; |
164 Compiler compiler = new TestCompiler(inputProvider, | 168 Compiler compiler = new TestCompiler(inputProvider, |
165 outputProvider, | 169 outputProvider, |
166 handler, | 170 handler, |
167 libraryRoot, | 171 libraryRoot, |
168 packageRoot, | 172 packageRoot, |
169 options, | 173 options, |
170 environment, | 174 environment, |
| 175 packageConfig, |
| 176 findPackages, |
171 marker, | 177 marker, |
172 type, | 178 type, |
173 onTest); | 179 onTest); |
174 return compiler.run(script).then((bool success) { | 180 return compiler.run(script).then((bool success) { |
175 return new api.CompilationResult(compiler, isSuccess: success); | 181 return new api.CompilationResult(compiler, isSuccess: success); |
176 }); | 182 }); |
177 } | 183 } |
178 | 184 |
179 int foundExitCode; | 185 int foundExitCode; |
180 | 186 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 | 269 |
264 expected = _expectedExitCode( | 270 expected = _expectedExitCode( |
265 beforeRun: tests[marker], fatalWarnings: true); | 271 beforeRun: tests[marker], fatalWarnings: true); |
266 totalExpectedErrors += expected.length; | 272 totalExpectedErrors += expected.length; |
267 await testExitCodes(marker, expected, ['--fatal-warnings']); | 273 await testExitCodes(marker, expected, ['--fatal-warnings']); |
268 } | 274 } |
269 | 275 |
270 Expect.equals(totalExpectedErrors, checkedResults); | 276 Expect.equals(totalExpectedErrors, checkedResults); |
271 }); | 277 }); |
272 } | 278 } |
OLD | NEW |