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 |
11 import 'package:async_helper/async_helper.dart'; | 11 import 'package:async_helper/async_helper.dart'; |
12 import 'package:expect/expect.dart'; | 12 import 'package:expect/expect.dart'; |
13 | 13 |
14 import 'package:compiler/compiler.dart' as old_api; | 14 import 'package:compiler/compiler.dart' as old_api; |
15 import 'package:compiler/compiler_new.dart' as api; | 15 import 'package:compiler/compiler_new.dart' as api; |
16 import 'package:compiler/src/common/codegen.dart'; | 16 import 'package:compiler/src/common/codegen.dart'; |
17 import 'package:compiler/src/compile_time_constants.dart'; | 17 import 'package:compiler/src/compile_time_constants.dart'; |
18 import 'package:compiler/src/compiler.dart'; | 18 import 'package:compiler/src/compiler.dart'; |
19 import 'package:compiler/src/dart2js.dart' as entry; | 19 import 'package:compiler/src/dart2js.dart' as entry; |
20 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; | 20 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; |
21 import 'package:compiler/src/diagnostics/invariant.dart'; | 21 import 'package:compiler/src/diagnostics/invariant.dart'; |
22 import 'package:compiler/src/diagnostics/messages.dart'; | 22 import 'package:compiler/src/diagnostics/messages.dart'; |
23 import 'package:compiler/src/diagnostics/spannable.dart'; | 23 import 'package:compiler/src/diagnostics/spannable.dart'; |
24 import 'package:compiler/src/apiimpl.dart' as apiimpl; | 24 import 'package:compiler/src/apiimpl.dart' as apiimpl; |
25 import 'package:compiler/src/enqueue.dart'; | 25 import 'package:compiler/src/enqueue.dart'; |
26 import 'package:compiler/src/elements/elements.dart'; | 26 import 'package:compiler/src/elements/elements.dart'; |
27 import 'package:compiler/src/library_loader.dart'; | 27 import 'package:compiler/src/library_loader.dart'; |
28 import 'package:compiler/src/null_compiler_output.dart'; | 28 import 'package:compiler/src/null_compiler_output.dart'; |
29 import 'package:compiler/src/old_to_new_api.dart'; | 29 import 'package:compiler/src/old_to_new_api.dart'; |
| 30 import 'package:compiler/src/options.dart' show CompilerOptions; |
30 import 'package:compiler/src/resolution/resolution.dart'; | 31 import 'package:compiler/src/resolution/resolution.dart'; |
31 import 'package:compiler/src/scanner/scanner_task.dart'; | 32 import 'package:compiler/src/scanner/scanner_task.dart'; |
32 import 'package:compiler/src/universe/world_impact.dart'; | 33 import 'package:compiler/src/universe/world_impact.dart'; |
33 import 'diagnostic_reporter_helper.dart'; | 34 import 'diagnostic_reporter_helper.dart'; |
34 | 35 |
35 class TestCompiler extends apiimpl.CompilerImpl { | 36 class TestCompiler extends apiimpl.CompilerImpl { |
36 final String testMarker; | 37 final String testMarker; |
37 final String testType; | 38 final String testType; |
38 final Function onTest; | 39 final Function onTest; |
39 DiagnosticReporter reporter; | 40 DiagnosticReporter reporter; |
40 | 41 |
41 TestCompiler(api.CompilerInput inputProvider, | 42 TestCompiler(api.CompilerInput inputProvider, |
42 api.CompilerOutput outputProvider, | 43 api.CompilerOutput outputProvider, |
43 api.CompilerDiagnostics handler, | 44 api.CompilerDiagnostics handler, |
44 Uri libraryRoot, | 45 Uri libraryRoot, |
45 Uri packageRoot, | 46 Uri packageRoot, |
46 List<String> options, | 47 List<String> options, |
47 Map<String, dynamic> environment, | 48 Map<String, dynamic> environment, |
48 Uri packageConfig, | 49 Uri packageConfig, |
49 api.PackagesDiscoveryProvider findPackages, | 50 api.PackagesDiscoveryProvider findPackages, |
50 String this.testMarker, | 51 String this.testMarker, |
51 String this.testType, | 52 String this.testType, |
52 Function this.onTest) | 53 Function this.onTest) |
53 : super(inputProvider, outputProvider, handler, | 54 : super(inputProvider, outputProvider, handler, |
54 new api.CompilerOptions.parse( | 55 new CompilerOptions.parse( |
55 libraryRoot: libraryRoot, | 56 libraryRoot: libraryRoot, |
56 packageRoot: packageRoot, | 57 packageRoot: packageRoot, |
57 options: options, | 58 options: options, |
58 environment: environment, | 59 environment: environment, |
59 packageConfig: packageConfig, | 60 packageConfig: packageConfig, |
60 packagesDiscoveryProvider: findPackages)) { | 61 packagesDiscoveryProvider: findPackages)) { |
61 reporter = new TestDiagnosticReporter(this, super.reporter); | 62 reporter = new TestDiagnosticReporter(this, super.reporter); |
62 test('Compiler'); | 63 test('Compiler'); |
63 } | 64 } |
64 | 65 |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 | 305 |
305 expected = _expectedExitCode( | 306 expected = _expectedExitCode( |
306 beforeRun: tests[marker], fatalWarnings: true); | 307 beforeRun: tests[marker], fatalWarnings: true); |
307 totalExpectedErrors += expected.length; | 308 totalExpectedErrors += expected.length; |
308 await testExitCodes(marker, expected, ['--fatal-warnings']); | 309 await testExitCodes(marker, expected, ['--fatal-warnings']); |
309 } | 310 } |
310 | 311 |
311 Expect.equals(totalExpectedErrors, checkedResults); | 312 Expect.equals(totalExpectedErrors, checkedResults); |
312 }); | 313 }); |
313 } | 314 } |
OLD | NEW |