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

Side by Side Diff: lib/src/runner/reporter/no_io_compact.dart

Issue 1044953004: Gracefully handle tests that print. (Closed) Base URL: git@github.com:dart-lang/unittest@master
Patch Set: Created 5 years, 8 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 | « lib/src/runner/reporter/compact.dart ('k') | lib/src/runner/vm/isolate_listener.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) 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 unittest.runner.reporter.no_io_compact; 5 library unittest.runner.reporter.no_io_compact;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import '../../backend/live_test.dart'; 9 import '../../backend/live_test.dart';
10 import '../../backend/state.dart'; 10 import '../../backend/state.dart';
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 _progressLine(_description(liveTest)); 87 _progressLine(_description(liveTest));
88 }); 88 });
89 89
90 liveTest.onError.listen((error) { 90 liveTest.onError.listen((error) {
91 if (liveTest.state.status != Status.complete) return; 91 if (liveTest.state.status != Status.complete) return;
92 92
93 _progressLine(_description(liveTest)); 93 _progressLine(_description(liveTest));
94 print(indent(error.error.toString())); 94 print(indent(error.error.toString()));
95 print(indent(terseChain(error.stackTrace).toString())); 95 print(indent(terseChain(error.stackTrace).toString()));
96 }); 96 });
97
98 liveTest.onPrint.listen((line) {
99 _progressLine(_description(liveTest));
100 print(line);
101 });
97 }); 102 });
98 } 103 }
99 104
100 /// Runs all tests in all provided suites. 105 /// Runs all tests in all provided suites.
101 /// 106 ///
102 /// This returns `true` if all tests succeed, and `false` otherwise. It will 107 /// This returns `true` if all tests succeed, and `false` otherwise. It will
103 /// only return once all tests have finished running. 108 /// only return once all tests have finished running.
104 Future<bool> run() { 109 Future<bool> run() {
105 if (_stopwatch.isRunning) { 110 if (_stopwatch.isRunning) {
106 throw new StateError("CompactReporter.run() may not be called more than " 111 throw new StateError("CompactReporter.run() may not be called more than "
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 name = "${liveTest.suite.path}: $name"; 200 name = "${liveTest.suite.path}: $name";
196 } 201 }
197 202
198 if (_multiplePlatforms && liveTest.suite.platform != null) { 203 if (_multiplePlatforms && liveTest.suite.platform != null) {
199 name = "[$liveTest.suite.platform] $name"; 204 name = "[$liveTest.suite.platform] $name";
200 } 205 }
201 206
202 return name; 207 return name;
203 } 208 }
204 } 209 }
OLDNEW
« no previous file with comments | « lib/src/runner/reporter/compact.dart ('k') | lib/src/runner/vm/isolate_listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698