Index: packages/async/test/stream_group_test.dart |
diff --git a/packages/async/test/stream_group_test.dart b/packages/async/test/stream_group_test.dart |
index db6c9387136cc4f39c1a94710baf9d80133c376d..65ddb42283dbabd910fb51913942454a6984e260 100644 |
--- a/packages/async/test/stream_group_test.dart |
+++ b/packages/async/test/stream_group_test.dart |
@@ -2,8 +2,6 @@ |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE file. |
-library async.test.stream_group_test; |
- |
import 'dart:async'; |
import 'package:async/async.dart'; |
@@ -77,22 +75,24 @@ main() { |
new StreamTransformer.fromHandlers( |
handleData: (data, sink) => sink.add("data: $data"), |
handleError: (error, _, sink) => sink.add("error: $error"))); |
- expect(transformed.toList(), completion(equals([ |
- "data: first", |
- "error: second", |
- "data: third", |
- "error: fourth", |
- "error: fifth", |
- "data: sixth" |
- ]))); |
+ expect( |
+ transformed.toList(), |
+ completion(equals([ |
+ "data: first", |
+ "error: second", |
+ "data: third", |
+ "error: fourth", |
+ "error: fifth", |
+ "data: sixth" |
+ ]))); |
}); |
test("emits events once there's a listener", () { |
var controller = new StreamController<String>(); |
streamGroup.add(controller.stream); |
- expect(streamGroup.stream.toList(), |
- completion(equals(["first", "second"]))); |
+ expect( |
+ streamGroup.stream.toList(), completion(equals(["first", "second"]))); |
controller.add("first"); |
controller.add("second"); |
@@ -139,8 +139,8 @@ main() { |
var controller = new StreamController<String>.broadcast(); |
streamGroup.add(controller.stream); |
- expect(streamGroup.stream.toList(), |
- completion(equals(["first", "second"]))); |
+ expect( |
+ streamGroup.stream.toList(), completion(equals(["first", "second"]))); |
controller.add("first"); |
controller.add("second"); |
@@ -152,8 +152,8 @@ main() { |
test("forwards cancel errors", () async { |
var subscription = streamGroup.stream.listen(null); |
- var controller = new StreamController<String>( |
- onCancel: () => throw "error"); |
+ var controller = |
+ new StreamController<String>(onCancel: () => throw "error"); |
streamGroup.add(controller.stream); |
await flushMicrotasks(); |
@@ -164,8 +164,8 @@ main() { |
var subscription = streamGroup.stream.listen(null); |
var completer = new Completer(); |
- var controller = new StreamController<String>( |
- onCancel: () => completer.future); |
+ var controller = |
+ new StreamController<String>(onCancel: () => completer.future); |
streamGroup.add(controller.stream); |
await flushMicrotasks(); |
@@ -180,15 +180,15 @@ main() { |
expect(fired, isTrue); |
}); |
- test("add() while active pauses the stream if the group is paused, then " |
+ test( |
+ "add() while active pauses the stream if the group is paused, then " |
"resumes once the group resumes", () async { |
var subscription = streamGroup.stream.listen(null); |
await flushMicrotasks(); |
var paused = false; |
var controller = new StreamController<String>( |
- onPause: () => paused = true, |
- onResume: () => paused = false); |
+ onPause: () => paused = true, onResume: () => paused = false); |
subscription.pause(); |
await flushMicrotasks(); |
@@ -213,7 +213,7 @@ main() { |
var canceled = false; |
var controller = new StreamController<String>(onListen: () { |
listened = true; |
- }, onCancel: expectAsync(() { |
+ }, onCancel: expectAsync0(() { |
expect(listened, isTrue); |
canceled = true; |
})); |
@@ -225,16 +225,16 @@ main() { |
}); |
test("forwards cancel errors", () { |
- var controller = new StreamController<String>( |
- onCancel: () => throw "error"); |
+ var controller = |
+ new StreamController<String>(onCancel: () => throw "error"); |
expect(streamGroup.add(controller.stream), throwsA("error")); |
}); |
test("forwards a cancel future", () async { |
var completer = new Completer(); |
- var controller = new StreamController<String>( |
- onCancel: () => completer.future); |
+ var controller = |
+ new StreamController<String>(onCancel: () => completer.future); |
var fired = false; |
streamGroup.add(controller.stream).then((_) => fired = true); |
@@ -270,8 +270,8 @@ main() { |
expect(streamGroup.close(), completes); |
- expect(streamGroup.stream.toList(), |
- completion(equals(["first", "second"]))); |
+ expect( |
+ streamGroup.stream.toList(), completion(equals(["first", "second"]))); |
}); |
test("emits events from multiple sources once there's a listener", () { |
@@ -281,8 +281,8 @@ main() { |
var controller2 = new StreamController<String>(); |
streamGroup.add(controller2.stream); |
- expect(streamGroup.stream.toList(), |
- completion(equals(["first", "second"]))); |
+ expect( |
+ streamGroup.stream.toList(), completion(equals(["first", "second"]))); |
controller1.add("first"); |
controller2.add("second"); |
@@ -327,8 +327,8 @@ main() { |
var controller = new StreamController<String>.broadcast(); |
streamGroup.add(controller.stream); |
- expect(streamGroup.stream.toList(), |
- completion(equals(["first", "second"]))); |
+ expect( |
+ streamGroup.stream.toList(), completion(equals(["first", "second"]))); |
controller.add("first"); |
controller.add("second"); |
@@ -358,8 +358,8 @@ main() { |
test("never cancels single-subscription streams", () async { |
var subscription = streamGroup.stream.listen(null); |
- var controller = new StreamController<String>( |
- onCancel: expectAsync(() {}, count: 0)); |
+ var controller = |
+ new StreamController<String>(onCancel: expectAsync0(() {}, count: 0)); |
streamGroup.add(controller.stream); |
await flushMicrotasks(); |
@@ -509,7 +509,7 @@ void regardlessOfType(StreamGroup<String> newStreamGroup()) { |
await flushMicrotasks(); |
controller.add("second"); |
- expect(streamGroup.remove(controller.stream), isNull); |
+ expect(streamGroup.remove(controller.stream), completion(null)); |
expect(streamGroup.close(), completes); |
}); |
@@ -550,7 +550,7 @@ void regardlessOfType(StreamGroup<String> newStreamGroup()) { |
expect(streamGroup.stream.toList(), completion(isEmpty)); |
controller.add("first"); |
- expect(streamGroup.remove(controller.stream), isNull); |
+ expect(streamGroup.remove(controller.stream), completion(null)); |
controller.add("second"); |
expect(streamGroup.close(), completes); |
@@ -570,8 +570,8 @@ void regardlessOfType(StreamGroup<String> newStreamGroup()) { |
}); |
test("forwards cancel errors", () async { |
- var controller = new StreamController<String>( |
- onCancel: () => throw "error"); |
+ var controller = |
+ new StreamController<String>(onCancel: () => throw "error"); |
streamGroup.add(controller.stream); |
streamGroup.stream.listen(null); |
@@ -582,8 +582,8 @@ void regardlessOfType(StreamGroup<String> newStreamGroup()) { |
test("forwards cancel futures", () async { |
var completer = new Completer(); |
- var controller = new StreamController<String>( |
- onCancel: () => completer.future); |
+ var controller = |
+ new StreamController<String>(onCancel: () => completer.future); |
streamGroup.stream.listen(null); |
await flushMicrotasks(); |
@@ -643,7 +643,8 @@ void regardlessOfType(StreamGroup<String> newStreamGroup()) { |
expect(streamGroup.stream.toList(), completion(isEmpty)); |
}); |
- test("if there are streams, closes the group once those streams close " |
+ test( |
+ "if there are streams, closes the group once those streams close " |
"and there's a listener", () async { |
var controller1 = new StreamController<String>(); |
var controller2 = new StreamController<String>(); |