| Index: tests/lib/async/stream_controller_async_test.dart
|
| diff --git a/tests/lib/async/stream_controller_async_test.dart b/tests/lib/async/stream_controller_async_test.dart
|
| index d66a6f164702fff2b4164b360fddfa7deb951e6d..0eb91fea6573c461bb000f66a90f3577ca20b3dd 100644
|
| --- a/tests/lib/async/stream_controller_async_test.dart
|
| +++ b/tests/lib/async/stream_controller_async_test.dart
|
| @@ -675,6 +675,56 @@ void testSink({bool sync, bool broadcast, bool asBroadcast}) {
|
| }
|
| });
|
| });
|
| +
|
| + test("$type-conroller-addstream-error-stop", () {
|
| + // Check that addStream defaults to ending after the first error.
|
| + var done = expectAsync0((){});
|
| + var c = broadcast ? new StreamController.broadcast(sync: sync)
|
| + : new StreamController(sync: sync);
|
| + var stream = asBroadcast ? c.stream.asBroadcastStream() : c.stream;
|
| + var actual = new Events.capture(stream);
|
| +
|
| + var source = new Events();
|
| + source..add(1)..add(2)..error("BAD")..add(3)..error("FAIL")..close();
|
| +
|
| + var expected = new Events()..add(1)..add(2)..error("BAD")..close();
|
| + StreamController sourceController = new StreamController();
|
| + c.addStream(sourceController.stream).then((_) {
|
| + print("stop-stream-end");
|
| + c.close().then((_) {
|
| + print("stop-all-end");
|
| + Expect.listEquals(expected.events, actual.events);
|
| + done();
|
| + });
|
| + });
|
| +
|
| + source.replay(sourceController);
|
| + });
|
| +
|
| + test("$type-conroller-addstream-error-forward", () {
|
| + // Check that addStream with cancelOnError:false passes all data and errors
|
| + // to the controller.
|
| + var done = expectAsync0((){});
|
| + var c = broadcast ? new StreamController.broadcast(sync: sync)
|
| + : new StreamController(sync: sync);
|
| + var stream = asBroadcast ? c.stream.asBroadcastStream() : c.stream;
|
| + var actual = new Events.capture(stream);
|
| +
|
| + var source = new Events();
|
| + source..add(1)..add(2)..addError("BAD")..add(3)..addError("FAIL")..close();
|
| +
|
| + StreamController sourceController = new StreamController();
|
| + c.addStream(sourceController.stream, cancelOnError: false).then((_) {
|
| + print("forward-stream-end");
|
| + c.close().then((_) {
|
| + print("forward-all-end");
|
| + Expect.listEquals(source.events, actual.events);
|
| + done();
|
| + });
|
| + });
|
| +
|
| + source.replay(sourceController);
|
| + });
|
| }
|
|
|
| main() {
|
|
|