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

Side by Side Diff: lib/compact_vm_config.dart

Issue 845153003: Bumped matcher version constraint (Closed) Base URL: https://github.com/dart-lang/unittest.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « CHANGELOG.md ('k') | lib/html_enhanced_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 /// A test configuration that generates a compact 1-line progress bar. The bar 5 /// A test configuration that generates a compact 1-line progress bar. The bar
6 /// is updated in-place before and after each test is executed. If all tests 6 /// is updated in-place before and after each test is executed. If all tests
7 /// pass, only a couple of lines are printed in the terminal. If a test fails, 7 /// pass, only a couple of lines are printed in the terminal. If a test fails,
8 /// the failure is shown and the progress bar continues to be updated below it. 8 /// the failure is shown and the progress bar continues to be updated below it.
9 library unittest.compact_vm_config; 9 library unittest.compact_vm_config;
10 10
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // Override and don't call the superclass onDone() to avoid printing the 85 // Override and don't call the superclass onDone() to avoid printing the
86 // "unittest-suite-..." boilerplate. 86 // "unittest-suite-..." boilerplate.
87 Future.wait([stdout.close(), stderr.close()]).then((_) { 87 Future.wait([stdout.close(), stderr.close()]).then((_) {
88 _receivePort.close(); 88 _receivePort.close();
89 exit(success ? 0 : 1); 89 exit(success ? 0 : 1);
90 }); 90 });
91 } 91 }
92 92
93 void onSummary(int passed, int failed, int errors, List<TestCase> results, 93 void onSummary(int passed, int failed, int errors, List<TestCase> results,
94 String uncaughtError) { 94 String uncaughtError) {
95 var success = false;
96 if (passed == 0 && failed == 0 && errors == 0 && uncaughtError == null) { 95 if (passed == 0 && failed == 0 && errors == 0 && uncaughtError == null) {
97 _print('\nNo tests ran.'); 96 _print('\nNo tests ran.');
98 } else if (failed == 0 && errors == 0 && uncaughtError == null) { 97 } else if (failed == 0 && errors == 0 && uncaughtError == null) {
99 _progressLine('All tests passed!', _NONE); 98 _progressLine('All tests passed!', _NONE);
100 _print(); 99 _print();
101 success = true;
102 } else { 100 } else {
103 _progressLine('Some tests failed.', _RED); 101 _progressLine('Some tests failed.', _RED);
104 _print(); 102 _print();
105 if (uncaughtError != null) { 103 if (uncaughtError != null) {
106 _print('Top-level uncaught error: $uncaughtError'); 104 _print('Top-level uncaught error: $uncaughtError');
107 } 105 }
108 _print('$passed PASSED, $failed FAILED, $errors ERRORS'); 106 _print('$passed PASSED, $failed FAILED, $errors ERRORS');
109 } 107 }
110 } 108 }
111 109
(...skipping 19 matching lines...) Expand all
131 buffer.write(': '); 129 buffer.write(': ');
132 buffer.write(color); 130 buffer.write(color);
133 131
134 // Ensure the line fits under MAX_LINE. [buffer] includes the color escape 132 // Ensure the line fits under MAX_LINE. [buffer] includes the color escape
135 // sequences too. Because these sequences are not visible characters, we 133 // sequences too. Because these sequences are not visible characters, we
136 // make sure they are not counted towards the limit. 134 // make sure they are not counted towards the limit.
137 int nonVisible = _nonVisiblePrefix + 135 int nonVisible = _nonVisiblePrefix +
138 color.length + 136 color.length +
139 (_fail != 0 ? (_RED.length + _NONE.length) : 0); 137 (_fail != 0 ? (_RED.length + _NONE.length) : 0);
140 int len = buffer.length - nonVisible; 138 int len = buffer.length - nonVisible;
141 var mx = MAX_LINE - len;
142 buffer.write(_snippet(message, MAX_LINE - len)); 139 buffer.write(_snippet(message, MAX_LINE - len));
143 buffer.write(_NONE); 140 buffer.write(_NONE);
144 141
145 // Pad the rest of the line so that it looks erased. 142 // Pad the rest of the line so that it looks erased.
146 len = buffer.length - nonVisible - _NONE.length; 143 len = buffer.length - nonVisible - _NONE.length;
147 if (len > _lastLength) { 144 if (len > _lastLength) {
148 _lastLength = len; 145 _lastLength = len;
149 } else { 146 } else {
150 while (len < _lastLength) { 147 while (len < _lastLength) {
151 buffer.write(' '); 148 buffer.write(' ');
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 // If the test is running on the Dart buildbots, we don't want to use this 205 // If the test is running on the Dart buildbots, we don't want to use this
209 // config since it's output may not be what the bots expect. 206 // config since it's output may not be what the bots expect.
210 if (Platform.environment['LOGNAME'] == 'chrome-bot') { 207 if (Platform.environment['LOGNAME'] == 'chrome-bot') {
211 return; 208 return;
212 } 209 }
213 210
214 unittestConfiguration = _singleton; 211 unittestConfiguration = _singleton;
215 } 212 }
216 213
217 final _singleton = new CompactVMConfiguration(); 214 final _singleton = new CompactVMConfiguration();
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | lib/html_enhanced_config.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698