Index: tests/compiler/dart2js/exit_code_test.dart |
diff --git a/tests/compiler/dart2js/exit_code_test.dart b/tests/compiler/dart2js/exit_code_test.dart |
index 9966f59feb6ebda835dd8c0899ce6c35087daf44..9b31127e2fe649310fadbe9e32313d60838a8e23 100644 |
--- a/tests/compiler/dart2js/exit_code_test.dart |
+++ b/tests/compiler/dart2js/exit_code_test.dart |
@@ -152,14 +152,15 @@ Future testExitCode(String marker, String type, int expectedExitCode) { |
} |
} |
return new Future(() { |
- Future<String> compile(Uri script, |
- Uri libraryRoot, |
- Uri packageRoot, |
- api.CompilerInputProvider inputProvider, |
- api.DiagnosticHandler handler, |
- [List<String> options = const [], |
- api.CompilerOutputProvider outputProvider, |
- Map<String, dynamic> environment = const {}]) { |
+ Future<api.CompilationResult> compile( |
+ Uri script, |
+ Uri libraryRoot, |
+ Uri packageRoot, |
+ api.CompilerInputProvider inputProvider, |
+ api.DiagnosticHandler handler, |
+ [List<String> options = const [], |
+ api.CompilerOutputProvider outputProvider, |
+ Map<String, dynamic> environment = const {}]) { |
libraryRoot = Platform.script.resolve('../../../sdk/'); |
outputProvider = NullSink.outputProvider; |
// Use this to silence the test when debugging: |
@@ -174,19 +175,8 @@ Future testExitCode(String marker, String type, int expectedExitCode) { |
marker, |
type, |
onTest); |
- return compiler.run(script).then((_) { |
- String code = compiler.assembledCode; |
- if (code != null && outputProvider != null) { |
- String outputType = 'js'; |
- if (options.contains('--output-type=dart')) { |
- outputType = 'dart'; |
- } |
- outputProvider('', outputType) |
- ..add(code) |
- ..close(); |
- code = ''; // Non-null signals success. |
- } |
- return code; |
+ return compiler.run(script).then((bool success) { |
+ return new api.CompilationResult(compiler, isSuccess: success); |
}); |
} |
@@ -214,7 +204,9 @@ Future testExitCode(String marker, String type, int expectedExitCode) { |
Future result = entry.internalMain( |
["tests/compiler/dart2js/exit_code_helper.dart"]); |
- return result.whenComplete(checkResult); |
+ return result.catchError((e, s) { |
+ // Capture crashes. |
+ }).whenComplete(checkResult); |
}); |
} |