| 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 /** | 5 /** |
| 6 * A test configuration that generates a compact 1-line progress bar. The bar is | 6 * A test configuration that generates a compact 1-line progress bar. The bar is |
| 7 * updated in-place before and after each test is executed. If all test pass, | 7 * updated in-place before and after each test is executed. If all test pass, |
| 8 * you should only see a couple lines in the terminal. If a test fails, the | 8 * you should only see a couple lines in the terminal. If a test fails, the |
| 9 * failure is shown and the progress bar continues to be updated below it. | 9 * failure is shown and the progress bar continues to be updated below it. |
| 10 */ | 10 */ |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| 60 String _indent(String str) { | 60 String _indent(String str) { |
| 61 return str.split("\n").mappedBy((line) => " $line").join("\n"); | 61 return str.split("\n").mappedBy((line) => " $line").join("\n"); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void onSummary(int passed, int failed, int errors, List<TestCase> results, | 64 void onSummary(int passed, int failed, int errors, List<TestCase> results, |
| 65 String uncaughtError) { | 65 String uncaughtError) { |
| 66 var success = false; | 66 var success = false; |
| 67 if (passed == 0 && failed == 0 && errors == 0) { | 67 if (passed == 0 && failed == 0 && errors == 0 && uncaughtError == null) { |
| 68 print('\nNo tests ran.'); | 68 print('\nNo tests ran.'); |
| 69 } else if (failed == 0 && errors == 0 && uncaughtError == null) { | 69 } else if (failed == 0 && errors == 0 && uncaughtError == null) { |
| 70 _progressLine(_start, _pass, _fail, 'All tests pass', _GREEN); | 70 _progressLine(_start, _pass, _fail, 'All tests pass', _GREEN); |
| 71 print('\nAll $passed tests passed.'); | 71 print('\nAll $passed tests passed.'); |
| 72 success = true; | 72 success = true; |
| 73 } else { | 73 } else { |
| 74 _progressLine(_start, _pass, _fail, 'Some tests fail', _RED); | 74 _progressLine(_start, _pass, _fail, 'Some tests fail', _RED); |
| 75 print(''); | 75 print(''); |
| 76 if (uncaughtError != null) { | 76 if (uncaughtError != null) { |
| 77 print('Top-level uncaught error: $uncaughtError'); | 77 print('Top-level uncaught error: $uncaughtError'); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 res = res.substring(firstSpace); | 164 res = res.substring(firstSpace); |
| 165 } | 165 } |
| 166 return '...$res'; | 166 return '...$res'; |
| 167 } | 167 } |
| 168 } | 168 } |
| 169 | 169 |
| 170 void useCompactVMConfiguration() { | 170 void useCompactVMConfiguration() { |
| 171 if (config != null) return; | 171 if (config != null) return; |
| 172 configure(new CompactVMConfiguration()); | 172 configure(new CompactVMConfiguration()); |
| 173 } | 173 } |
| OLD | NEW |