| 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'; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 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/elements/elements.dart'; | 25 import 'package:compiler/src/elements/elements.dart'; |
| 26 import 'package:compiler/src/js_backend/js_backend.dart'; | 26 import 'package:compiler/src/js_backend/js_backend.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/options.dart' show CompilerOptions; | 29 import 'package:compiler/src/options.dart' show CompilerOptions; |
| 30 import 'package:compiler/src/resolution/resolution.dart'; | 30 import 'package:compiler/src/resolution/resolution.dart'; |
| 31 import 'package:compiler/src/scanner/scanner_task.dart'; | 31 import 'package:compiler/src/scanner/scanner_task.dart'; |
| 32 import 'package:compiler/src/universe/world_impact.dart'; | 32 import 'package:compiler/src/universe/world_impact.dart'; |
| 33 import 'package:compiler/src/world.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 TestDiagnosticReporter reporter; | 40 TestDiagnosticReporter reporter; |
| 40 | 41 |
| 41 TestCompiler( | 42 TestCompiler( |
| 42 api.CompilerInput inputProvider, | 43 api.CompilerInput inputProvider, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 TestBackend(TestCompiler compiler) | 122 TestBackend(TestCompiler compiler) |
| 122 : this.compiler = compiler, | 123 : this.compiler = compiler, |
| 123 super(compiler, | 124 super(compiler, |
| 124 generateSourceMap: compiler.options.generateSourceMap, | 125 generateSourceMap: compiler.options.generateSourceMap, |
| 125 useStartupEmitter: compiler.options.useStartupEmitter, | 126 useStartupEmitter: compiler.options.useStartupEmitter, |
| 126 useMultiSourceInfo: compiler.options.useMultiSourceInfo, | 127 useMultiSourceInfo: compiler.options.useMultiSourceInfo, |
| 127 useNewSourceInfo: compiler.options.useNewSourceInfo, | 128 useNewSourceInfo: compiler.options.useNewSourceInfo, |
| 128 useKernel: compiler.options.useKernel); | 129 useKernel: compiler.options.useKernel); |
| 129 | 130 |
| 130 @override | 131 @override |
| 131 WorldImpact codegen(CodegenWorkItem work) { | 132 WorldImpact codegen(CodegenWorkItem work, ClosedWorld closedWorld) { |
| 132 compiler.test('Compiler.codegen'); | 133 compiler.test('Compiler.codegen'); |
| 133 return super.codegen(work); | 134 return super.codegen(work, closedWorld); |
| 134 } | 135 } |
| 135 } | 136 } |
| 136 | 137 |
| 137 class TestDiagnosticReporter extends DiagnosticReporterWrapper { | 138 class TestDiagnosticReporter extends DiagnosticReporterWrapper { |
| 138 TestCompiler compiler; | 139 TestCompiler compiler; |
| 139 DiagnosticReporter reporter; | 140 DiagnosticReporter reporter; |
| 140 | 141 |
| 141 @override | 142 @override |
| 142 withCurrentElement(Element element, f()) { | 143 withCurrentElement(Element element, f()) { |
| 143 return super.withCurrentElement(element, () { | 144 return super.withCurrentElement(element, () { |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 309 |
| 309 expected = | 310 expected = |
| 310 _expectedExitCode(beforeRun: tests[marker], fatalWarnings: true); | 311 _expectedExitCode(beforeRun: tests[marker], fatalWarnings: true); |
| 311 totalExpectedErrors += expected.length; | 312 totalExpectedErrors += expected.length; |
| 312 await testExitCodes(marker, expected, ['--fatal-warnings']); | 313 await testExitCodes(marker, expected, ['--fatal-warnings']); |
| 313 } | 314 } |
| 314 | 315 |
| 315 Expect.equals(totalExpectedErrors, checkedResults); | 316 Expect.equals(totalExpectedErrors, checkedResults); |
| 316 }); | 317 }); |
| 317 } | 318 } |
| OLD | NEW |