Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #library("test_progress"); | 5 #library("test_progress"); |
| 6 | 6 |
| 7 #import("dart:io"); | 7 #import("dart:io"); |
| 8 #import("test_runner.dart"); | 8 #import("test_runner.dart"); |
| 9 #import("test_suite.dart"); | 9 #import("test_suite.dart"); |
| 10 | 10 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 | 82 |
| 83 void allDone() { | 83 void allDone() { |
| 84 _printFailureSummary(); | 84 _printFailureSummary(); |
| 85 _printStatus(); | 85 _printStatus(); |
| 86 _printTimingInformation(); | 86 _printTimingInformation(); |
| 87 stdout.close(); | 87 stdout.close(); |
| 88 stderr.close(); | 88 stderr.close(); |
| 89 exit(_failedTests > 0 ? 1 : 0); | 89 if (_failedTests > 0) exit(1); |
|
gram
2012/10/08 22:34:08
Did you intend to make this change? It seems the o
Emily Fortuna
2012/10/08 22:37:23
Yes, this was intentional. As mentioned in the com
| |
| 90 } | 90 } |
| 91 | 91 |
| 92 void _printStartProgress(TestCase test) {} | 92 void _printStartProgress(TestCase test) {} |
| 93 void _printDoneProgress(TestCase test) {} | 93 void _printDoneProgress(TestCase test) {} |
| 94 | 94 |
| 95 String _pad(String s, int length) { | 95 String _pad(String s, int length) { |
| 96 StringBuffer buffer = new StringBuffer(); | 96 StringBuffer buffer = new StringBuffer(); |
| 97 for (int i = s.length; i < length; i++) { | 97 for (int i = s.length; i < length; i++) { |
| 98 buffer.add(' '); | 98 buffer.add(' '); |
| 99 } | 99 } |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 | 213 |
| 214 class SilentProgressIndicator extends ProgressIndicator { | 214 class SilentProgressIndicator extends ProgressIndicator { |
| 215 SilentProgressIndicator(Date startTime, bool printTiming) | 215 SilentProgressIndicator(Date startTime, bool printTiming) |
| 216 : super(startTime, printTiming); | 216 : super(startTime, printTiming); |
| 217 void testAdded() { } | 217 void testAdded() { } |
| 218 void start(TestCase test) { } | 218 void start(TestCase test) { } |
| 219 void done(TestCase test) { } | 219 void done(TestCase test) { } |
| 220 void _printStartProgress(TestCase test) { } | 220 void _printStartProgress(TestCase test) { } |
| 221 void _printDoneProgress(TestCase test) { } | 221 void _printDoneProgress(TestCase test) { } |
| 222 void allTestsKnown() { } | 222 void allTestsKnown() { } |
| 223 void allDone() { | 223 void allDone() { } |
| 224 exit(0); | |
| 225 } | |
| 226 } | 224 } |
| 227 | 225 |
| 228 abstract class CompactIndicator extends ProgressIndicator { | 226 abstract class CompactIndicator extends ProgressIndicator { |
| 229 CompactIndicator(Date startTime, bool printTiming) | 227 CompactIndicator(Date startTime, bool printTiming) |
| 230 : super(startTime, printTiming); | 228 : super(startTime, printTiming); |
| 231 | 229 |
| 232 void allDone() { | 230 void allDone() { |
| 233 stdout.write('\n'.charCodes()); | 231 stdout.write('\n'.charCodes()); |
| 234 _printFailureSummary(); | 232 _printFailureSummary(); |
| 235 _printTimingInformation(); | 233 _printTimingInformation(); |
| 236 if (_failedTests > 0) { | 234 if (_failedTests > 0) { |
| 237 // We may have printed many failure logs, so reprint the summary data. | 235 // We may have printed many failure logs, so reprint the summary data. |
| 238 _printProgress(); | 236 _printProgress(); |
| 239 print(''); | 237 print(''); |
| 240 } | 238 } |
| 241 stdout.close(); | 239 stdout.close(); |
| 242 stderr.close(); | 240 stderr.close(); |
| 243 exit(_failedTests > 0 ? 1 : 0); | 241 if (_failedTests > 0) exit(1); |
|
gram
2012/10/08 22:34:08
Ditto
| |
| 244 } | 242 } |
| 245 | 243 |
| 246 void allTestsKnown() { | 244 void allTestsKnown() { |
| 247 if (!_allTestsKnown && SummaryReport.total > 0) { | 245 if (!_allTestsKnown && SummaryReport.total > 0) { |
| 248 // Clear progress indicator before printing summary report. | 246 // Clear progress indicator before printing summary report. |
| 249 stdout.write( | 247 stdout.write( |
| 250 '\r \r'.charCodes()); | 248 '\r \r'.charCodes()); |
| 251 SummaryReport.printReport(); | 249 SummaryReport.printReport(); |
| 252 } | 250 } |
| 253 _allTestsKnown = true; | 251 _allTestsKnown = true; |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 413 print(''); | 411 print(''); |
| 414 print('$key:'); | 412 print('$key:'); |
| 415 lines.sort((a, b) => a.compareTo(b)); | 413 lines.sort((a, b) => a.compareTo(b)); |
| 416 for (String line in lines) { | 414 for (String line in lines) { |
| 417 print(' $line'); | 415 print(' $line'); |
| 418 } | 416 } |
| 419 }); | 417 }); |
| 420 _printStatus(); | 418 _printStatus(); |
| 421 } | 419 } |
| 422 } | 420 } |
| OLD | NEW |