| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 buffer.write('+'); | 94 buffer.write('+'); |
| 95 buffer.write(passed); | 95 buffer.write(passed); |
| 96 buffer.write(_NONE); | 96 buffer.write(_NONE); |
| 97 if (failed != 0) buffer.write(_RED); | 97 if (failed != 0) buffer.write(_RED); |
| 98 buffer.write(' -'); | 98 buffer.write(' -'); |
| 99 buffer.write(failed); | 99 buffer.write(failed); |
| 100 if (failed != 0) buffer.write(_NONE); | 100 if (failed != 0) buffer.write(_NONE); |
| 101 buffer.write(': '); | 101 buffer.write(': '); |
| 102 buffer.write(color); | 102 buffer.write(color); |
| 103 | 103 |
| 104 // Ensure the line fits under MAX_LINE. [buffer] includes the color escape |
| 105 // sequences too. Because these sequences are not visible characters, we |
| 106 // make sure they are not counted towards the limit. |
| 104 int nonVisible = _nonVisiblePrefix + color.length + | 107 int nonVisible = _nonVisiblePrefix + color.length + |
| 105 (failed != 0 ? (_RED.length + _NONE.length) : 0); | 108 (failed != 0 ? (_RED.length + _NONE.length) : 0); |
| 106 int len = buffer.length - nonVisible; | 109 int len = buffer.length - nonVisible; |
| 107 var mx = MAX_LINE - len; | 110 var mx = MAX_LINE - len; |
| 108 buffer.write(_snippet(message, MAX_LINE - len)); | 111 buffer.write(_snippet(message, MAX_LINE - len)); |
| 109 buffer.write(_NONE); | 112 buffer.write(_NONE); |
| 110 | 113 |
| 111 // Pad the rest of the line so that it looks erased. | 114 // Pad the rest of the line so that it looks erased. |
| 112 len = buffer.length - nonVisible - _NONE.length; | 115 len = buffer.length - nonVisible - _NONE.length; |
| 113 if (len > _lastLength) { | 116 if (len > _lastLength) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 res = res.substring(firstSpace); | 167 res = res.substring(firstSpace); |
| 165 } | 168 } |
| 166 return '...$res'; | 169 return '...$res'; |
| 167 } | 170 } |
| 168 } | 171 } |
| 169 | 172 |
| 170 void useCompactVMConfiguration() { | 173 void useCompactVMConfiguration() { |
| 171 if (config != null) return; | 174 if (config != null) return; |
| 172 configure(new CompactVMConfiguration()); | 175 configure(new CompactVMConfiguration()); |
| 173 } | 176 } |
| OLD | NEW |