| 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 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 void exit(exitCode) { | 235 void exit(exitCode) { |
| 236 if (foundExitCode == null) { | 236 if (foundExitCode == null) { |
| 237 foundExitCode = exitCode; | 237 foundExitCode = exitCode; |
| 238 } | 238 } |
| 239 }; | 239 }; |
| 240 | 240 |
| 241 entry.exitFunc = exit; | 241 entry.exitFunc = exit; |
| 242 entry.compileFunc = compile; | 242 entry.compileFunc = compile; |
| 243 | 243 |
| 244 List<String> args = new List<String>.from(options) | 244 List<String> args = new List<String>.from(options) |
| 245 ..add("tests/compiler/dart2js/exit_code_helper.dart"); | 245 ..add("tests/compiler/dart2js/data/exit_code_helper.dart"); |
| 246 Future result = entry.internalMain(args); | 246 Future result = entry.internalMain(args); |
| 247 return result.catchError((e, s) { | 247 return result.catchError((e, s) { |
| 248 // Capture crashes. | 248 // Capture crashes. |
| 249 }).whenComplete(checkResult); | 249 }).whenComplete(checkResult); |
| 250 }); | 250 }); |
| 251 } | 251 } |
| 252 | 252 |
| 253 Future testExitCodes( | 253 Future testExitCodes( |
| 254 String marker, Map<String,int> expectedExitCodes, List<String> options) { | 254 String marker, Map<String,int> expectedExitCodes, List<String> options) { |
| 255 return Future.forEach(expectedExitCodes.keys, (String type) { | 255 return Future.forEach(expectedExitCodes.keys, (String type) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 306 |
| 307 expected = _expectedExitCode( | 307 expected = _expectedExitCode( |
| 308 beforeRun: tests[marker], fatalWarnings: true); | 308 beforeRun: tests[marker], fatalWarnings: true); |
| 309 totalExpectedErrors += expected.length; | 309 totalExpectedErrors += expected.length; |
| 310 await testExitCodes(marker, expected, ['--fatal-warnings']); | 310 await testExitCodes(marker, expected, ['--fatal-warnings']); |
| 311 } | 311 } |
| 312 | 312 |
| 313 Expect.equals(totalExpectedErrors, checkedResults); | 313 Expect.equals(totalExpectedErrors, checkedResults); |
| 314 }); | 314 }); |
| 315 } | 315 } |
| OLD | NEW |