| 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, fatal errors, errors, | 5 // Test the exit code of dart2js in case of exceptions, fatal errors, errors, |
| 6 // warnings, etc. | 6 // warnings, etc. |
| 7 | 7 |
| 8 | 8 |
| 9 import 'dart:async'; | 9 import 'dart:async'; |
| 10 import 'dart:io' show Platform; | 10 import 'dart:io' show Platform; |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 }); | 211 }); |
| 212 } | 212 } |
| 213 | 213 |
| 214 Future testExitCodes(String marker, Map<String,int> expectedExitCodes) { | 214 Future testExitCodes(String marker, Map<String,int> expectedExitCodes) { |
| 215 return Future.forEach(expectedExitCodes.keys, (String type) { | 215 return Future.forEach(expectedExitCodes.keys, (String type) { |
| 216 return testExitCode(marker, type, expectedExitCodes[type]); | 216 return testExitCode(marker, type, expectedExitCodes[type]); |
| 217 }); | 217 }); |
| 218 } | 218 } |
| 219 | 219 |
| 220 void main() { | 220 void main() { |
| 221 // TODO(johnniwinther): implement this test for unchecked mode. |
| 221 bool isCheckedMode = false; | 222 bool isCheckedMode = false; |
| 222 assert(isCheckedMode = true); | 223 assert(isCheckedMode = true); |
| 223 Expect.isTrue(isCheckedMode, 'This test must be run in checked mode.'); | 224 Expect.isTrue(isCheckedMode, 'This test must be run in checked mode.'); |
| 224 | 225 |
| 225 const beforeRun = const { | 226 const beforeRun = const { |
| 226 '': 0, | 227 '': 0, |
| 227 'NoSuchMethodError': 253, | 228 'NoSuchMethodError': 253, |
| 228 'assert': 253, | 229 'assert': 253, |
| 229 'invariant': 253 | 230 'invariant': 253 |
| 230 }; | 231 }; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 258 int countResults(Map runType) { | 259 int countResults(Map runType) { |
| 259 return runType.length * | 260 return runType.length * |
| 260 tests.values.where((r) => r == runType).length; | 261 tests.values.where((r) => r == runType).length; |
| 261 } | 262 } |
| 262 | 263 |
| 263 Expect.equals(countResults(beforeRun) + countResults(duringRun), | 264 Expect.equals(countResults(beforeRun) + countResults(duringRun), |
| 264 checkedResults); | 265 checkedResults); |
| 265 asyncEnd(); | 266 asyncEnd(); |
| 266 }); | 267 }); |
| 267 } | 268 } |
| OLD | NEW |