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

Unified Diff: test/stream_completer_test.dart

Issue 1615253002: Add ClosedStreamSink, and *Completer.setError, and StreamSinkCompleter.fromFuture. (Closed) Base URL: git@github.com:dart-lang/async.git@master
Patch Set: Code review changes Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/null_stream_sink_test.dart ('k') | test/stream_sink_completer_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/stream_completer_test.dart
diff --git a/test/stream_completer_test.dart b/test/stream_completer_test.dart
index cd3ceb9fa49a78fce51ac6f299db7a31a8c02dd9..76d81d1c3146dcc0d983cb9ab3ac5d6177df8d86 100644
--- a/test/stream_completer_test.dart
+++ b/test/stream_completer_test.dart
@@ -337,6 +337,34 @@ main() {
});
expect(controller.hasListener, isFalse);
});
+
+ group("setError()", () {
+ test("produces a stream that emits a single error", () {
+ var completer = new StreamCompleter();
+ completer.stream.listen(
+ unreachable("data"),
+ onError: expectAsync((error, stackTrace) {
+ expect(error, equals("oh no"));
+ }),
+ onDone: expectAsync(() {}));
+
+ completer.setError("oh no");
+ });
+
+ test("produces a stream that emits a single error on a later listen",
+ () async {
+ var completer = new StreamCompleter();
+ completer.setError("oh no");
+ await flushMicrotasks();
+
+ completer.stream.listen(
+ unreachable("data"),
+ onError: expectAsync((error, stackTrace) {
+ expect(error, equals("oh no"));
+ }),
+ onDone: expectAsync(() {}));
+ });
+ });
}
Stream<int> createStream() async* {
« no previous file with comments | « test/null_stream_sink_test.dart ('k') | test/stream_sink_completer_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698