| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 void start(TestCase test) { } | 213 void start(TestCase test) { } |
| 214 void done(TestCase test) { } | 214 void done(TestCase test) { } |
| 215 void _printStartProgress(TestCase test) { } | 215 void _printStartProgress(TestCase test) { } |
| 216 void _printDoneProgress(TestCase test) { } | 216 void _printDoneProgress(TestCase test) { } |
| 217 void allTestsKnown() { } | 217 void allTestsKnown() { } |
| 218 void allDone() { | 218 void allDone() { |
| 219 exit(0); | 219 exit(0); |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 | 222 |
| 223 class CompactIndicator extends ProgressIndicator { | 223 abstract class CompactIndicator extends ProgressIndicator { |
| 224 CompactIndicator(Date startTime, bool printTiming) | 224 CompactIndicator(Date startTime, bool printTiming) |
| 225 : super(startTime, printTiming); | 225 : super(startTime, printTiming); |
| 226 | 226 |
| 227 void allDone() { | 227 void allDone() { |
| 228 stdout.write('\n'.charCodes()); | 228 stdout.write('\n'.charCodes()); |
| 229 _printFailureSummary(); | 229 _printFailureSummary(); |
| 230 _printTimingInformation(); | 230 _printTimingInformation(); |
| 231 if (_failedTests > 0) { | 231 if (_failedTests > 0) { |
| 232 // We may have printed many failure logs, so reprint the summary data. | 232 // We may have printed many failure logs, so reprint the summary data. |
| 233 _printProgress(); | 233 _printProgress(); |
| 234 print(''); | 234 print(''); |
| 235 } | 235 } |
| 236 stdout.close(); | 236 stdout.close(); |
| 237 exit(_failedTests > 0 ? 1 : 0); | 237 exit(_failedTests > 0 ? 1 : 0); |
| 238 } | 238 } |
| 239 | 239 |
| 240 void allTestsKnown() { | 240 void allTestsKnown() { |
| 241 if (!_allTestsKnown && SummaryReport.total > 0) { | 241 if (!_allTestsKnown && SummaryReport.total > 0) { |
| 242 // Clear progress indicator before printing summary report. | 242 // Clear progress indicator before printing summary report. |
| 243 stdout.write( | 243 stdout.write( |
| 244 '\r \r'.charCodes()); | 244 '\r \r'.charCodes()); |
| 245 SummaryReport.printReport(); | 245 SummaryReport.printReport(); |
| 246 } | 246 } |
| 247 _allTestsKnown = true; | 247 _allTestsKnown = true; |
| 248 } | 248 } |
| 249 | 249 |
| 250 void _printStartProgress(TestCase test) => _printProgress(); | 250 void _printStartProgress(TestCase test) => _printProgress(); |
| 251 void _printDoneProgress(TestCase test) => _printProgress(); | 251 void _printDoneProgress(TestCase test) => _printProgress(); |
| 252 | 252 |
| 253 abstract void _printProgress(); | 253 void _printProgress(); |
| 254 } | 254 } |
| 255 | 255 |
| 256 | 256 |
| 257 class CompactProgressIndicator extends CompactIndicator { | 257 class CompactProgressIndicator extends CompactIndicator { |
| 258 CompactProgressIndicator(Date startTime, bool printTiming) | 258 CompactProgressIndicator(Date startTime, bool printTiming) |
| 259 : super(startTime, printTiming); | 259 : super(startTime, printTiming); |
| 260 | 260 |
| 261 void _printProgress() { | 261 void _printProgress() { |
| 262 var percent = ((_completedTests() / _foundTests) * 100).toInt().toString(); | 262 var percent = ((_completedTests() / _foundTests) * 100).toInt().toString(); |
| 263 var progressPadded = _pad(_allTestsKnown ? percent : '--', 3); | 263 var progressPadded = _pad(_allTestsKnown ? percent : '--', 3); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 print(''); | 400 print(''); |
| 401 print('$key:'); | 401 print('$key:'); |
| 402 lines.sort((a, b) => a.compareTo(b)); | 402 lines.sort((a, b) => a.compareTo(b)); |
| 403 for (String line in lines) { | 403 for (String line in lines) { |
| 404 print(' $line'); | 404 print(' $line'); |
| 405 } | 405 } |
| 406 }); | 406 }); |
| 407 _printStatus(); | 407 _printStatus(); |
| 408 } | 408 } |
| 409 } | 409 } |
| OLD | NEW |