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* { |