| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // Pad the rest of the line so that it looks erased. | 114 // Pad the rest of the line so that it looks erased. |
| 115 len = buffer.length - nonVisible - _NONE.length; | 115 len = buffer.length - nonVisible - _NONE.length; |
| 116 if (len > _lastLength) { | 116 if (len > _lastLength) { |
| 117 _lastLength = len; | 117 _lastLength = len; |
| 118 } else { | 118 } else { |
| 119 while (len < _lastLength) { | 119 while (len < _lastLength) { |
| 120 buffer.write(' '); | 120 buffer.write(' '); |
| 121 _lastLength--; | 121 _lastLength--; |
| 122 } | 122 } |
| 123 } | 123 } |
| 124 stdout.addString(buffer.toString()); | 124 stdout.write(buffer.toString()); |
| 125 } | 125 } |
| 126 | 126 |
| 127 String _padTime(int time) => | 127 String _padTime(int time) => |
| 128 (time == 0) ? '00' : ((time < 10) ? '0$time' : '$time'); | 128 (time == 0) ? '00' : ((time < 10) ? '0$time' : '$time'); |
| 129 | 129 |
| 130 String _timeString(Duration duration) { | 130 String _timeString(Duration duration) { |
| 131 var min = duration.inMinutes; | 131 var min = duration.inMinutes; |
| 132 var sec = duration.inSeconds % 60; | 132 var sec = duration.inSeconds % 60; |
| 133 return '${_padTime(min)}:${_padTime(sec)}'; | 133 return '${_padTime(min)}:${_padTime(sec)}'; |
| 134 } | 134 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 res = res.substring(firstSpace); | 167 res = res.substring(firstSpace); |
| 168 } | 168 } |
| 169 return '...$res'; | 169 return '...$res'; |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 | 172 |
| 173 void useCompactVMConfiguration() { | 173 void useCompactVMConfiguration() { |
| 174 if (config != null) return; | 174 if (config != null) return; |
| 175 configure(new CompactVMConfiguration()); | 175 configure(new CompactVMConfiguration()); |
| 176 } | 176 } |
| OLD | NEW |