OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.runner.reporter.compact; | 5 library test.runner.reporter.compact; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 import 'dart:isolate'; | 9 import 'dart:isolate'; |
10 | 10 |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 /// [message] goes after the progress report, and may be truncated to fit the | 295 /// [message] goes after the progress report, and may be truncated to fit the |
296 /// entire line within [_lineLength]. If [color] is passed, it's used as the | 296 /// entire line within [_lineLength]. If [color] is passed, it's used as the |
297 /// color for [message]. | 297 /// color for [message]. |
298 bool _progressLine(String message, {String color, bool truncate: true}) { | 298 bool _progressLine(String message, {String color, bool truncate: true}) { |
299 var elapsed = _stopwatch.elapsed.inSeconds; | 299 var elapsed = _stopwatch.elapsed.inSeconds; |
300 | 300 |
301 // Print nothing if nothing has changed since the last progress line. | 301 // Print nothing if nothing has changed since the last progress line. |
302 if (_engine.passed.length == _lastProgressPassed && | 302 if (_engine.passed.length == _lastProgressPassed && |
303 _engine.skipped.length == _lastProgressSkipped && | 303 _engine.skipped.length == _lastProgressSkipped && |
304 _engine.failed.length == _lastProgressFailed && | 304 _engine.failed.length == _lastProgressFailed && |
305 elapsed == _lastProgressElapsed && | |
306 message == _lastProgressMessage && | 305 message == _lastProgressMessage && |
307 truncate == _lastProgressTruncated) { | 306 // Don't re-print just because the message became re-truncated, because |
| 307 // that doesn't add information. |
| 308 (truncate || !_lastProgressTruncated) && |
| 309 // If we printed a newline, that means the last line *wasn't* a progress |
| 310 // line. In that case, we don't want to print a new progress line just |
| 311 // because the elapsed time changed. |
| 312 (_printedNewline || elapsed == _lastProgressElapsed)) { |
308 return false; | 313 return false; |
309 } | 314 } |
310 | 315 |
311 _lastProgressPassed = _engine.passed.length; | 316 _lastProgressPassed = _engine.passed.length; |
312 _lastProgressSkipped = _engine.skipped.length; | 317 _lastProgressSkipped = _engine.skipped.length; |
313 _lastProgressFailed = _engine.failed.length; | 318 _lastProgressFailed = _engine.failed.length; |
314 _lastProgressElapsed = elapsed; | 319 _lastProgressElapsed = elapsed; |
315 _lastProgressMessage = message; | 320 _lastProgressMessage = message; |
316 _lastProgressTruncated = truncate; | 321 _lastProgressTruncated = truncate; |
317 | 322 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 | 383 |
379 if (_printPlatform && liveTest.suite.platform != null) { | 384 if (_printPlatform && liveTest.suite.platform != null) { |
380 name = "[${liveTest.suite.platform.name}] $name"; | 385 name = "[${liveTest.suite.platform.name}] $name"; |
381 } | 386 } |
382 | 387 |
383 if (liveTest.suite is LoadSuite) name = "$_bold$_gray$name$_noColor"; | 388 if (liveTest.suite is LoadSuite) name = "$_bold$_gray$name$_noColor"; |
384 | 389 |
385 return name; | 390 return name; |
386 } | 391 } |
387 } | 392 } |
OLD | NEW |