| 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 #library("test_progress"); | 5 #library("test_progress"); |
| 6 | 6 |
| 7 #import("test_runner.dart"); | 7 #import("test_runner.dart"); |
| 8 | 8 |
| 9 class ProgressIndicator { | 9 class ProgressIndicator { |
| 10 ProgressIndicator(this._startTime); | 10 ProgressIndicator(this._startTime); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 int _failedTests = 0; | 113 int _failedTests = 0; |
| 114 Date _startTime; | 114 Date _startTime; |
| 115 } | 115 } |
| 116 | 116 |
| 117 | 117 |
| 118 class CompactProgressIndicator extends ProgressIndicator { | 118 class CompactProgressIndicator extends ProgressIndicator { |
| 119 CompactProgressIndicator(Date startTime) : super(startTime); | 119 CompactProgressIndicator(Date startTime) : super(startTime); |
| 120 | 120 |
| 121 void allDone() { | 121 void allDone() { |
| 122 stdout.write('\n'.charCodes()); | 122 stdout.write('\n'.charCodes()); |
| 123 stdout.close(); |
| 123 } | 124 } |
| 124 | 125 |
| 125 void _printProgress() { | 126 void _printProgress() { |
| 126 var percent = ((_completedTests() / _foundTests) * 100).floor().toString(); | 127 var percent = ((_completedTests() / _foundTests) * 100).floor().toString(); |
| 127 var percentPadded = _pad(percent, 5); | 128 var percentPadded = _pad(percent, 5); |
| 128 var passedPadded = _pad(_passedTests.toString(), 5); | 129 var passedPadded = _pad(_passedTests.toString(), 5); |
| 129 var failedPadded = _pad(_failedTests.toString(), 5); | 130 var failedPadded = _pad(_failedTests.toString(), 5); |
| 130 var progressLine = | 131 var progressLine = |
| 131 '\r[${_timeString()} | $percentPadded% | ' + | 132 '\r[${_timeString()} | $percentPadded% | ' + |
| 132 '+$passedPadded | -$failedPadded]'; | 133 '+$passedPadded | -$failedPadded]'; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 var status = 'pass'; | 209 var status = 'pass'; |
| 209 if (test.output.unexpectedOutput) { | 210 if (test.output.unexpectedOutput) { |
| 210 status = 'fail'; | 211 status = 'fail'; |
| 211 } | 212 } |
| 212 var percent = ((_completedTests() / _foundTests) * 100).toInt().toString(); | 213 var percent = ((_completedTests() / _foundTests) * 100).toInt().toString(); |
| 213 print('Done ${test.displayName}: $status'); | 214 print('Done ${test.displayName}: $status'); |
| 214 print('@@@STEP_CLEAR@@@'); | 215 print('@@@STEP_CLEAR@@@'); |
| 215 print('@@@STEP_TEXT@ $percent% +$_passedTests -$_failedTests @@@'); | 216 print('@@@STEP_TEXT@ $percent% +$_passedTests -$_failedTests @@@'); |
| 216 } | 217 } |
| 217 } | 218 } |
| OLD | NEW |