Chromium Code Reviews| Index: pkg/unittest/lib/compact_vm_config.dart |
| diff --git a/pkg/unittest/lib/compact_vm_config.dart b/pkg/unittest/lib/compact_vm_config.dart |
| index 362b5f8f2f1dcae206ce40adbabfccb81e137b6b..a6f28ab98c7ea830e2d6a4b1d82ea387065c9448 100644 |
| --- a/pkg/unittest/lib/compact_vm_config.dart |
| +++ b/pkg/unittest/lib/compact_vm_config.dart |
| @@ -28,8 +28,10 @@ class CompactVMConfiguration extends VMConfiguration { |
| ReceivePort _receivePort; |
| DateTime _start; |
| - int _pass = 0; |
| - int _fail = 0; |
| + Set<int> _passing = new Set(); |
| + Set<int> _failing = new Set(); |
| + int get _pass => _passing.length; |
| + int get _fail => _failing.length; |
| void onInit() { |
| _receivePort = new ReceivePort(); |
| @@ -43,17 +45,17 @@ class CompactVMConfiguration extends VMConfiguration { |
| void onTestStart(TestCase test) { |
| super.onTestStart(test); |
| - _progressLine(_start, _pass, _fail, test.description); |
| + _progressLine(test.description); |
| } |
| void onTestResult(TestCase test) { |
| super.onTestResult(test); |
| if (test.result == PASS) { |
| - _pass++; |
| - _progressLine(_start, _pass, _fail, test.description); |
| + _passing.add(test.id); |
| + _progressLine(test.description); |
| } else { |
| - _fail++; |
| - _progressLine(_start, _pass, _fail, test.description); |
| + _failing.add(test.id); |
| + _progressLine(test.description); |
| _print(); |
| if (test.message != '') { |
| _print(indent(test.message)); |
| @@ -65,10 +67,11 @@ class CompactVMConfiguration extends VMConfiguration { |
| } |
| } |
| + Set passing = new Set(); |
|
blois
2014/04/03 22:45:21
there's passing and _passing?
Siggi Cherem (dart-lang)
2014/04/03 22:46:06
thanks! Done
|
| void onTestResultChanged(TestCase test) { |
| - _pass--; |
|
Siggi Cherem (dart-lang)
2014/04/03 22:39:39
the main problem was here. Results can also change
|
| - _fail++; |
| - _progressLine(_start, _pass, _fail, test.description); |
| + _passing.remove(test.id); |
| + _failing.add(test.id); |
| + _progressLine(test.description); |
| _print(); |
| if (test.message != '') { |
| _print(indent(test.message)); |
| @@ -94,11 +97,11 @@ class CompactVMConfiguration extends VMConfiguration { |
| if (passed == 0 && failed == 0 && errors == 0 && uncaughtError == null) { |
| _print('\nNo tests ran.'); |
| } else if (failed == 0 && errors == 0 && uncaughtError == null) { |
| - _progressLine(_start, _pass, _fail, 'All tests passed!', _NONE); |
| + _progressLine('All tests passed!', _NONE); |
| _print(); |
| success = true; |
| } else { |
| - _progressLine(_start, _pass, _fail, 'Some tests failed.', _RED); |
| + _progressLine('Some tests failed.', _RED); |
| _print(); |
| if (uncaughtError != null) { |
| _print('Top-level uncaught error: $uncaughtError'); |
| @@ -111,20 +114,19 @@ class CompactVMConfiguration extends VMConfiguration { |
| final int _nonVisiblePrefix = 1 + _GREEN.length + _NONE.length; |
| - void _progressLine(DateTime startTime, int passed, int failed, String message, |
| - [String color = _NONE]) { |
| - var duration = (new DateTime.now()).difference(startTime); |
| + void _progressLine(String message, [String color = _NONE]) { |
| + var duration = (new DateTime.now()).difference(_start); |
| var buffer = new StringBuffer(); |
| // \r moves back to the beginning of the current line. |
| buffer.write('\r${_timeString(duration)} '); |
| buffer.write(_GREEN); |
| buffer.write('+'); |
| - buffer.write(passed); |
| + buffer.write(_pass); |
| buffer.write(_NONE); |
| - if (failed != 0) { |
| + if (_fail != 0) { |
| buffer.write(_RED); |
| buffer.write(' -'); |
| - buffer.write(failed); |
| + buffer.write(_fail); |
| buffer.write(_NONE); |
| } |
| buffer.write(': '); |
| @@ -134,7 +136,7 @@ class CompactVMConfiguration extends VMConfiguration { |
| // sequences too. Because these sequences are not visible characters, we |
| // make sure they are not counted towards the limit. |
| int nonVisible = _nonVisiblePrefix + color.length + |
| - (failed != 0 ? (_RED.length + _NONE.length) : 0); |
| + (_fail != 0 ? (_RED.length + _NONE.length) : 0); |
| int len = buffer.length - nonVisible; |
| var mx = MAX_LINE - len; |
| buffer.write(_snippet(message, MAX_LINE - len)); |