| 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 b70fe4ab17df4b862cee7950a397c6e96688e4fa..0303d28e755760451e3a09124f046cccba8ad4c8 100644
|
| --- a/tests/compiler/dart2js/exit_code_test.dart
|
| +++ b/tests/compiler/dart2js/exit_code_test.dart
|
| @@ -137,7 +137,8 @@ class TestResolver extends ResolverTask {
|
|
|
| int checkedResults = 0;
|
|
|
| -Future testExitCode(String marker, String type, int expectedExitCode) {
|
| +Future testExitCode(
|
| + String marker, String type, int expectedExitCode, List options) {
|
| bool testOccurred = false;
|
|
|
| void onTest(String testMarker, String testType) {
|
| @@ -196,17 +197,19 @@ Future testExitCode(String marker, String type, int expectedExitCode) {
|
| entry.exitFunc = exit;
|
| entry.compileFunc = compile;
|
|
|
| - Future result = entry.internalMain(
|
| - ["tests/compiler/dart2js/exit_code_helper.dart"]);
|
| + List<String> args = new List<String>.from(options)
|
| + ..add("tests/compiler/dart2js/exit_code_helper.dart");
|
| + Future result = entry.internalMain(args);
|
| return result.catchError((e, s) {
|
| // Capture crashes.
|
| }).whenComplete(checkResult);
|
| });
|
| }
|
|
|
| -Future testExitCodes(String marker, Map<String,int> expectedExitCodes) {
|
| +Future testExitCodes(
|
| + String marker, Map<String,int> expectedExitCodes, List<String> options) {
|
| return Future.forEach(expectedExitCodes.keys, (String type) {
|
| - return testExitCode(marker, type, expectedExitCodes[type]);
|
| + return testExitCode(marker, type, expectedExitCodes[type], options);
|
| });
|
| }
|
|
|
| @@ -214,23 +217,30 @@ void main() {
|
| bool isCheckedMode = false;
|
| assert((isCheckedMode = true));
|
|
|
| - final beforeRun = {
|
| - '': 0,
|
| - 'NoSuchMethodError': 253,
|
| - 'assert': isCheckedMode ? 253 : 0,
|
| - 'invariant': 253
|
| - };
|
| + Map _expectedExitCode({bool beforeRun: false, bool fatalWarnings: false}) {
|
| + if (beforeRun) {
|
| + return {
|
| + '': 0,
|
| + 'NoSuchMethodError': 253,
|
| + 'assert': isCheckedMode ? 253 : 0,
|
| + 'invariant': 253
|
| + };
|
| + }
|
|
|
| - final duringRun = {
|
| - '': 0,
|
| - 'NoSuchMethodError': 253,
|
| - 'assert': isCheckedMode ? 253 : 0,
|
| - 'invariant': 253,
|
| - 'warning': 0,
|
| - 'error': 1,
|
| - 'internalError': 253,
|
| - };
|
| + // duringRun:
|
| + return {
|
| + '': 0,
|
| + 'NoSuchMethodError': 253,
|
| + 'assert': isCheckedMode ? 253 : 0,
|
| + 'invariant': 253,
|
| + 'warning': fatalWarnings ? 1 : 0,
|
| + 'error': 1,
|
| + 'internalError': 253,
|
| + };
|
| + }
|
|
|
| + const beforeRun = false;
|
| + const duringRun = true;
|
| final tests = {
|
| 'Compiler': beforeRun,
|
| 'Compiler.run': beforeRun,
|
| @@ -242,18 +252,20 @@ void main() {
|
| 'Compiler.codegen': duringRun,
|
| 'ResolverTask.computeClassMembers': duringRun,
|
| };
|
| -
|
| - asyncStart();
|
| - Future.forEach(tests.keys, (marker) {
|
| - return testExitCodes(marker, tests[marker]);
|
| - }).then((_) {
|
| - int countResults(Map runType) {
|
| - return runType.length *
|
| - tests.values.where((r) => r == runType).length;
|
| + int totalExpectedErrors = 0;
|
| +
|
| + asyncTest(() async {
|
| + for (String marker in tests.keys) {
|
| + var expected = _expectedExitCode(beforeRun: tests[marker]);
|
| + totalExpectedErrors += expected.length;
|
| + await testExitCodes(marker, expected, []);
|
| +
|
| + expected = _expectedExitCode(
|
| + beforeRun: tests[marker], fatalWarnings: true);
|
| + totalExpectedErrors += expected.length;
|
| + await testExitCodes(marker, expected, ['--fatal-warnings']);
|
| }
|
|
|
| - Expect.equals(countResults(beforeRun) + countResults(duringRun),
|
| - checkedResults);
|
| - asyncEnd();
|
| + Expect.equals(totalExpectedErrors, checkedResults);
|
| });
|
| }
|
|
|