Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: pkg/unittest/lib/compact_vm_config.dart

Issue 12598008: pkg/unittest: fixed deprecations in alt configs (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: spelling and copyright year Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/unittest/lib/html_layout_config.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 82
83 int _lastLength = 0; 83 int _lastLength = 0;
84 84
85 final int _nonVisiblePrefix = 1 + _GREEN.length + _NONE.length; 85 final int _nonVisiblePrefix = 1 + _GREEN.length + _NONE.length;
86 86
87 void _progressLine(DateTime startTime, int passed, int failed, String message, 87 void _progressLine(DateTime startTime, int passed, int failed, String message,
88 [String color = _NONE]) { 88 [String color = _NONE]) {
89 var duration = (new DateTime.now()).difference(startTime); 89 var duration = (new DateTime.now()).difference(startTime);
90 var buffer = new StringBuffer(); 90 var buffer = new StringBuffer();
91 // \r moves back to the beginnig of the current line. 91 // \r moves back to the beginning of the current line.
92 buffer.write('\r${_timeString(duration)} '); 92 buffer.write('\r${_timeString(duration)} ');
93 buffer.write(_GREEN); 93 buffer.write(_GREEN);
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(': ');
(...skipping 12 matching lines...) Expand all
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
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 }
OLDNEW
« no previous file with comments | « no previous file | pkg/unittest/lib/html_layout_config.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698