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

Unified Diff: test/runner/isolate_listener_test.dart

Issue 1044953004: Gracefully handle tests that print. (Closed) Base URL: git@github.com:dart-lang/unittest@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/runner/compact_reporter_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/runner/isolate_listener_test.dart
diff --git a/test/runner/isolate_listener_test.dart b/test/runner/isolate_listener_test.dart
index 184c86dbcccc0dc224b0c27cf87fde8b18dbcf42..06d92443331331197edeefa2ceda5e43623a030b 100644
--- a/test/runner/isolate_listener_test.dart
+++ b/test/runner/isolate_listener_test.dart
@@ -262,6 +262,15 @@ void main() {
});
});
});
+
+ test("forwards a test's prints", () {
+ return _isolateTest(_printTest).then((liveTest) {
+ expect(liveTest.onPrint.take(2).toList(),
+ completion(equals(["Hello,", "world!"])));
+
+ return liveTest.run();
+ });
+ });
}
/// Loads the first test defined in [entryPoint] in another isolate.
@@ -380,3 +389,14 @@ void _multiErrorTest(SendPort sendPort) {
});
});
}
+
+/// An isolate entrypoint that defines a test that prints twice.
+void _printTest(SendPort sendPort) {
+ IsolateListener.start(sendPort, () => () {
+ test("prints", () {
+ print("Hello,");
+ return new Future(() => print("world!"));
+ });
+ });
+}
+
« no previous file with comments | « test/runner/compact_reporter_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698