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 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io' show Platform; | 8 import 'dart:io' show Platform; |
9 | 9 |
10 import 'package:async_helper/async_helper.dart'; | 10 import 'package:async_helper/async_helper.dart'; |
11 import 'package:expect/expect.dart'; | 11 import 'package:expect/expect.dart'; |
12 | 12 |
13 import 'package:compiler/compiler_new.dart' as api; | 13 import 'package:compiler/compiler_new.dart' as api; |
14 import 'package:compiler/src/common/codegen.dart'; | 14 import 'package:compiler/src/common/codegen.dart'; |
15 import 'package:compiler/src/common/resolution.dart'; | 15 import 'package:compiler/src/common/resolution.dart'; |
16 import 'package:compiler/src/compile_time_constants.dart'; | 16 import 'package:compiler/src/compile_time_constants.dart'; |
17 import 'package:compiler/src/compiler.dart'; | 17 import 'package:compiler/src/compiler.dart'; |
18 import 'package:compiler/src/dart2js.dart' as entry; | 18 import 'package:compiler/src/dart2js.dart' as entry; |
19 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; | 19 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; |
20 import 'package:compiler/src/diagnostics/invariant.dart'; | 20 import 'package:compiler/src/diagnostics/invariant.dart'; |
21 import 'package:compiler/src/diagnostics/messages.dart'; | 21 import 'package:compiler/src/diagnostics/messages.dart'; |
22 import 'package:compiler/src/diagnostics/spannable.dart'; | 22 import 'package:compiler/src/diagnostics/spannable.dart'; |
23 import 'package:compiler/src/apiimpl.dart' as apiimpl; | 23 import 'package:compiler/src/apiimpl.dart' as apiimpl; |
24 import 'package:compiler/src/elements/elements.dart'; | 24 import 'package:compiler/src/elements/elements.dart'; |
| 25 import 'package:compiler/src/elements/entities.dart'; |
25 import 'package:compiler/src/js_backend/js_backend.dart'; | 26 import 'package:compiler/src/js_backend/js_backend.dart'; |
26 import 'package:compiler/src/library_loader.dart'; | 27 import 'package:compiler/src/library_loader.dart'; |
27 import 'package:compiler/src/null_compiler_output.dart'; | 28 import 'package:compiler/src/null_compiler_output.dart'; |
28 import 'package:compiler/src/options.dart' show CompilerOptions; | 29 import 'package:compiler/src/options.dart' show CompilerOptions; |
29 import 'package:compiler/src/resolution/resolution.dart'; | 30 import 'package:compiler/src/resolution/resolution.dart'; |
30 import 'package:compiler/src/scanner/scanner_task.dart'; | 31 import 'package:compiler/src/scanner/scanner_task.dart'; |
31 import 'package:compiler/src/universe/world_impact.dart'; | 32 import 'package:compiler/src/universe/world_impact.dart'; |
32 import 'package:compiler/src/world.dart'; | 33 import 'package:compiler/src/world.dart'; |
33 import 'diagnostic_reporter_helper.dart'; | 34 import 'diagnostic_reporter_helper.dart'; |
34 | 35 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 compiler.test('Compiler.codegen'); | 132 compiler.test('Compiler.codegen'); |
132 return super.codegen(work, closedWorld); | 133 return super.codegen(work, closedWorld); |
133 } | 134 } |
134 } | 135 } |
135 | 136 |
136 class TestDiagnosticReporter extends DiagnosticReporterWrapper { | 137 class TestDiagnosticReporter extends DiagnosticReporterWrapper { |
137 TestCompiler compiler; | 138 TestCompiler compiler; |
138 DiagnosticReporter reporter; | 139 DiagnosticReporter reporter; |
139 | 140 |
140 @override | 141 @override |
141 withCurrentElement(Element element, f()) { | 142 withCurrentElement(Entity element, f()) { |
142 return super.withCurrentElement(element, () { | 143 return super.withCurrentElement(element, () { |
143 compiler.test('Compiler.withCurrentElement'); | 144 compiler.test('Compiler.withCurrentElement'); |
144 return f(); | 145 return f(); |
145 }); | 146 }); |
146 } | 147 } |
147 } | 148 } |
148 | 149 |
149 class TestScanner extends ScannerTask { | 150 class TestScanner extends ScannerTask { |
150 final TestCompiler compiler; | 151 final TestCompiler compiler; |
151 | 152 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 | 308 |
308 expected = | 309 expected = |
309 _expectedExitCode(beforeRun: tests[marker], fatalWarnings: true); | 310 _expectedExitCode(beforeRun: tests[marker], fatalWarnings: true); |
310 totalExpectedErrors += expected.length; | 311 totalExpectedErrors += expected.length; |
311 await testExitCodes(marker, expected, ['--fatal-warnings']); | 312 await testExitCodes(marker, expected, ['--fatal-warnings']); |
312 } | 313 } |
313 | 314 |
314 Expect.equals(totalExpectedErrors, checkedResults); | 315 Expect.equals(totalExpectedErrors, checkedResults); |
315 }); | 316 }); |
316 } | 317 } |
OLD | NEW |