| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 part of unittest; | 5 part of unittest; |
| 6 | 6 |
| 7 // A custom failure handler for [expect] that routes expect failures | 7 // A custom failure handler for [expect] that routes expect failures |
| 8 // to the config. | 8 // to the config. |
| 9 class _ExpectFailureHandler extends DefaultFailureHandler { | 9 class _ExpectFailureHandler extends DefaultFailureHandler { |
| 10 Configuration _config; | 10 Configuration _config; |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 * the result summary using the built-in [print] command. Browser tests | 187 * the result summary using the built-in [print] command. Browser tests |
| 188 * commonly override this to reformat the output. | 188 * commonly override this to reformat the output. |
| 189 * | 189 * |
| 190 * When [uncaughtError] is not null, it contains an error that occured outside | 190 * When [uncaughtError] is not null, it contains an error that occured outside |
| 191 * of tests (e.g. setting up the test). | 191 * of tests (e.g. setting up the test). |
| 192 */ | 192 */ |
| 193 void onSummary(int passed, int failed, int errors, List<TestCase> results, | 193 void onSummary(int passed, int failed, int errors, List<TestCase> results, |
| 194 String uncaughtError) { | 194 String uncaughtError) { |
| 195 // Print each test's result. | 195 // Print each test's result. |
| 196 for (final t in results) { | 196 for (final t in results) { |
| 197 print(formatResult(t)); | 197 print(formatResult(t).trim()); |
| 198 } | 198 } |
| 199 | 199 |
| 200 // Show the summary. | 200 // Show the summary. |
| 201 print(''); | 201 print(''); |
| 202 | 202 |
| 203 if (passed == 0 && failed == 0 && errors == 0 && uncaughtError == null) { | 203 if (passed == 0 && failed == 0 && errors == 0 && uncaughtError == null) { |
| 204 print('No tests found.'); | 204 print('No tests found.'); |
| 205 // This is considered a failure too. | 205 // This is considered a failure too. |
| 206 } else if (failed == 0 && errors == 0 && uncaughtError == null) { | 206 } else if (failed == 0 && errors == 0 && uncaughtError == null) { |
| 207 print('All $passed tests passed.'); | 207 print('All $passed tests passed.'); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 234 // Currently e.message works in dartium, but not in dartc. | 234 // Currently e.message works in dartium, but not in dartc. |
| 235 void handleExternalError(e, String message, [stack]) => | 235 void handleExternalError(e, String message, [stack]) => |
| 236 _reportTestError('$message\nCaught $e', stack); | 236 _reportTestError('$message\nCaught $e', stack); |
| 237 | 237 |
| 238 _postMessage(String message) { | 238 _postMessage(String message) { |
| 239 // In dart2js browser tests, the JavaScript-based test controller | 239 // In dart2js browser tests, the JavaScript-based test controller |
| 240 // intercepts calls to print and listens for "secret" messages. | 240 // intercepts calls to print and listens for "secret" messages. |
| 241 print(message); | 241 print(message); |
| 242 } | 242 } |
| 243 } | 243 } |
| OLD | NEW |