| Index: tests/lib/async/stream_controller_test.dart
|
| diff --git a/tests/lib/async/stream_controller_test.dart b/tests/lib/async/stream_controller_test.dart
|
| index 37c1bf9e93c410e0ece62d00bcfe6907f33ed849..313ccef92ba67dd73fc71f45c291b7912bfa3e69 100644
|
| --- a/tests/lib/async/stream_controller_test.dart
|
| +++ b/tests/lib/async/stream_controller_test.dart
|
| @@ -8,9 +8,9 @@ library stream_controller_test;
|
| import 'dart:async';
|
| import 'event_helper.dart';
|
|
|
| -testController() {
|
| +testMultiController() {
|
| // Test normal flow.
|
| - var c = new StreamController();
|
| + var c = new StreamController.multiSubscription();
|
| Events expectedEvents = new Events()
|
| ..add(42)
|
| ..add("dibs")
|
| @@ -22,7 +22,7 @@ testController() {
|
| Expect.listEquals(expectedEvents.events, actualEvents.events);
|
|
|
| // Test automatic unsubscription on error.
|
| - c = new StreamController();
|
| + c = new StreamController.multiSubscription();
|
| expectedEvents = new Events()..add(42)..error("error");
|
| actualEvents = new Events.capture(c, unsubscribeOnError: true);
|
| Events sentEvents =
|
| @@ -31,7 +31,7 @@ testController() {
|
| Expect.listEquals(expectedEvents.events, actualEvents.events);
|
|
|
| // Test manual unsubscription.
|
| - c = new StreamController();
|
| + c = new StreamController.multiSubscription();
|
| expectedEvents = new Events()..add(42)..error("error")..add(37);
|
| actualEvents = new Events.capture(c, unsubscribeOnError: false);
|
| expectedEvents.replay(c);
|
| @@ -40,7 +40,7 @@ testController() {
|
| Expect.listEquals(expectedEvents.events, actualEvents.events);
|
|
|
| // Test filter.
|
| - c = new StreamController();
|
| + c = new StreamController.multiSubscription();
|
| expectedEvents = new Events()
|
| ..add("a string")..add("another string")..close();
|
| sentEvents = new Events()
|
| @@ -50,7 +50,7 @@ testController() {
|
| Expect.listEquals(expectedEvents.events, actualEvents.events);
|
|
|
| // Test map.
|
| - c = new StreamController();
|
| + c = new StreamController.multiSubscription();
|
| expectedEvents = new Events()..add("abab")..error("error")..close();
|
| sentEvents = new Events()..add("ab")..error("error")..close();
|
| actualEvents = new Events.capture(c.mappedBy((v) => "$v$v"));
|
| @@ -58,7 +58,7 @@ testController() {
|
| Expect.listEquals(expectedEvents.events, actualEvents.events);
|
|
|
| // Test handleError.
|
| - c = new StreamController();
|
| + c = new StreamController.multiSubscription();
|
| expectedEvents = new Events()..add("ab")..error("[foo]");
|
| sentEvents = new Events()..add("ab")..error("foo")..add("ab")..close();
|
| actualEvents = new Events.capture(c.handleError((v) {
|
| @@ -73,7 +73,7 @@ testController() {
|
| // reduce is tested asynchronously and therefore not in this file.
|
|
|
| // Test expand
|
| - c = new StreamController();
|
| + c = new StreamController.multiSubscription();
|
| sentEvents = new Events()..add(3)..add(2)..add(4)..close();
|
| expectedEvents = new Events()..add(1)..add(2)..add(3)
|
| ..add(1)..add(2)
|
| @@ -88,7 +88,7 @@ testController() {
|
| Expect.listEquals(expectedEvents.events, actualEvents.events);
|
|
|
| // Test transform.
|
| - c = new StreamController();
|
| + c = new StreamController.multiSubscription();
|
| sentEvents = new Events()..add("a")..error(42)..add("b")..close();
|
| expectedEvents =
|
| new Events()..error("a")..add(42)..error("b")..add("foo")..close();
|
| @@ -103,7 +103,7 @@ testController() {
|
| Expect.listEquals(expectedEvents.events, actualEvents.events);
|
|
|
| // Test multiple filters.
|
| - c = new StreamController();
|
| + c = new StreamController.multiSubscription();
|
| sentEvents = new Events()..add(42)
|
| ..add("snugglefluffy")
|
| ..add(7)
|
| @@ -123,7 +123,7 @@ testController() {
|
| Expect.listEquals(expectedEvents.events, actualEvents.events);
|
|
|
| // Test subscription changes while firing.
|
| - c = new StreamController();
|
| + c = new StreamController.multiSubscription();
|
| var sink = c.sink;
|
| var stream = c.stream;
|
| var counter = 0;
|
| @@ -150,7 +150,7 @@ testController() {
|
|
|
| testSingleController() {
|
| // Test normal flow.
|
| - var c = new StreamController.singleSubscription();
|
| + var c = new StreamController();
|
| Events expectedEvents = new Events()
|
| ..add(42)
|
| ..add("dibs")
|
| @@ -162,7 +162,7 @@ testSingleController() {
|
| Expect.listEquals(expectedEvents.events, actualEvents.events);
|
|
|
| // Test automatic unsubscription on error.
|
| - c = new StreamController.singleSubscription();
|
| + c = new StreamController();
|
| expectedEvents = new Events()..add(42)..error("error");
|
| actualEvents = new Events.capture(c, unsubscribeOnError: true);
|
| Events sentEvents =
|
| @@ -171,7 +171,7 @@ testSingleController() {
|
| Expect.listEquals(expectedEvents.events, actualEvents.events);
|
|
|
| // Test manual unsubscription.
|
| - c = new StreamController.singleSubscription();
|
| + c = new StreamController();
|
| expectedEvents = new Events()..add(42)..error("error")..add(37);
|
| actualEvents = new Events.capture(c, unsubscribeOnError: false);
|
| expectedEvents.replay(c);
|
| @@ -180,7 +180,7 @@ testSingleController() {
|
| Expect.listEquals(expectedEvents.events, actualEvents.events);
|
|
|
| // Test filter.
|
| - c = new StreamController.singleSubscription();
|
| + c = new StreamController();
|
| expectedEvents = new Events()
|
| ..add("a string")..add("another string")..close();
|
| sentEvents = new Events()
|
| @@ -190,7 +190,7 @@ testSingleController() {
|
| Expect.listEquals(expectedEvents.events, actualEvents.events);
|
|
|
| // Test map.
|
| - c = new StreamController.singleSubscription();
|
| + c = new StreamController();
|
| expectedEvents = new Events()..add("abab")..error("error")..close();
|
| sentEvents = new Events()..add("ab")..error("error")..close();
|
| actualEvents = new Events.capture(c.mappedBy((v) => "$v$v"));
|
| @@ -198,7 +198,7 @@ testSingleController() {
|
| Expect.listEquals(expectedEvents.events, actualEvents.events);
|
|
|
| // Test handleError.
|
| - c = new StreamController.singleSubscription();
|
| + c = new StreamController();
|
| expectedEvents = new Events()..add("ab")..error("[foo]");
|
| sentEvents = new Events()..add("ab")..error("foo")..add("ab")..close();
|
| actualEvents = new Events.capture(c.handleError((v) {
|
| @@ -213,7 +213,7 @@ testSingleController() {
|
| // reduce is tested asynchronously and therefore not in this file.
|
|
|
| // Test expand
|
| - c = new StreamController.singleSubscription();
|
| + c = new StreamController();
|
| sentEvents = new Events()..add(3)..add(2)..add(4)..close();
|
| expectedEvents = new Events()..add(1)..add(2)..add(3)
|
| ..add(1)..add(2)
|
| @@ -228,7 +228,7 @@ testSingleController() {
|
| Expect.listEquals(expectedEvents.events, actualEvents.events);
|
|
|
| // pipe is tested asynchronously and therefore not in this file.
|
| - c = new StreamController.singleSubscription();
|
| + c = new StreamController();
|
| var list = <int>[];
|
| c.pipeInto(new CollectionSink<int>(list))
|
| .whenComplete(() { Expect.listEquals(<int>[1,2,9,3,9], list); });
|
| @@ -240,7 +240,7 @@ testSingleController() {
|
| c.close();
|
|
|
| // Test transform.
|
| - c = new StreamController.singleSubscription();
|
| + c = new StreamController();
|
| sentEvents = new Events()..add("a")..error(42)..add("b")..close();
|
| expectedEvents =
|
| new Events()..error("a")..add(42)..error("b")..add("foo")..close();
|
| @@ -255,7 +255,7 @@ testSingleController() {
|
| Expect.listEquals(expectedEvents.events, actualEvents.events);
|
|
|
| // Test multiple filters.
|
| - c = new StreamController.singleSubscription();
|
| + c = new StreamController();
|
| sentEvents = new Events()..add(42)
|
| ..add("snugglefluffy")
|
| ..add(7)
|
| @@ -275,7 +275,7 @@ testSingleController() {
|
| Expect.listEquals(expectedEvents.events, actualEvents.events);
|
|
|
| // Test that only one subscription is allowed.
|
| - c = new StreamController.singleSubscription();
|
| + c = new StreamController();
|
| var sink = c.sink;
|
| var stream = c.stream;
|
| var counter = 0;
|
| @@ -355,7 +355,7 @@ testExtraMethods() {
|
| }
|
|
|
| main() {
|
| - testController();
|
| + testMultiController();
|
| testSingleController();
|
| testExtraMethods();
|
| }
|
|
|