Index: tests/lib/async/stream_timeout_test.dart |
diff --git a/tests/lib/async/stream_timeout_test.dart b/tests/lib/async/stream_timeout_test.dart |
index e0854960d2564c22abed53dcaa8ae59878eb6dc8..127aee7579eb782e19cabf153aaeb6d35d422fe6 100644 |
--- a/tests/lib/async/stream_timeout_test.dart |
+++ b/tests/lib/async/stream_timeout_test.dart |
@@ -16,7 +16,9 @@ main() { |
tos.handleError(expectAsync((e, s) { |
expect(e, new isInstanceOf<TimeoutException>()); |
expect(s, null); |
- })).listen((v){ fail("Unexpected event"); }); |
+ })).listen((v) { |
+ fail("Unexpected event"); |
+ }); |
}); |
test("stream timeout add events", () { |
@@ -27,9 +29,11 @@ main() { |
sink.close(); |
}); |
expect(tos.isBroadcast, false); |
- tos.listen(expectAsync((v) { expect(v, 42); }), |
- onError: expectAsync((e, s) { expect(e, "ERROR"); }), |
- onDone: expectAsync((){})); |
+ tos.listen(expectAsync((v) { |
+ expect(v, 42); |
+ }), onError: expectAsync((e, s) { |
+ expect(e, "ERROR"); |
+ }), onDone: expectAsync(() {})); |
}); |
test("stream no timeout", () { |
@@ -37,15 +41,18 @@ main() { |
Stream tos = c.stream.timeout(twoSecs); |
int ctr = 0; |
tos.listen((v) { |
- expect(v, 42); |
- ctr++; |
- }, |
- onError: (e, s) { fail("No error expected"); }, |
- onDone: expectAsync(() { |
- expect(ctr, 2); |
- })); |
+ expect(v, 42); |
+ ctr++; |
+ }, onError: (e, s) { |
+ fail("No error expected"); |
+ }, onDone: expectAsync(() { |
+ expect(ctr, 2); |
+ })); |
expect(tos.isBroadcast, false); |
- c..add(42)..add(42)..close(); // Faster than a timeout! |
+ c |
+ ..add(42) |
+ ..add(42) |
+ ..close(); // Faster than a timeout! |
}); |
test("stream timeout after events", () { |
@@ -54,44 +61,49 @@ main() { |
expect(tos.isBroadcast, false); |
int ctr = 0; |
tos.listen((v) { |
- expect(v, 42); |
- ctr++; |
- }, |
- onError: expectAsync((e, s) { |
- expect(ctr, 2); |
- expect(e, new isInstanceOf<TimeoutException>()); |
- })); |
- c..add(42)..add(42); // No close, timeout after two events. |
+ expect(v, 42); |
+ ctr++; |
+ }, onError: expectAsync((e, s) { |
+ expect(ctr, 2); |
+ expect(e, new isInstanceOf<TimeoutException>()); |
+ })); |
+ c..add(42)..add(42); // No close, timeout after two events. |
}); |
- test("broadcast stream timeout", () { |
+ test("broadcast stream timeout", () { |
StreamController c = new StreamController.broadcast(); |
Stream tos = c.stream.timeout(ms5); |
expect(tos.isBroadcast, true); |
tos.handleError(expectAsync((e, s) { |
expect(e, new isInstanceOf<TimeoutException>()); |
expect(s, null); |
- })).listen((v){ fail("Unexpected event"); }); |
+ })).listen((v) { |
+ fail("Unexpected event"); |
+ }); |
}); |
- test("asBroadcast stream timeout", () { |
+ test("asBroadcast stream timeout", () { |
StreamController c = new StreamController.broadcast(); |
Stream tos = c.stream.asBroadcastStream().timeout(ms5); |
expect(tos.isBroadcast, true); |
tos.handleError(expectAsync((e, s) { |
expect(e, new isInstanceOf<TimeoutException>()); |
expect(s, null); |
- })).listen((v){ fail("Unexpected event"); }); |
+ })).listen((v) { |
+ fail("Unexpected event"); |
+ }); |
}); |
- test("mapped stream timeout", () { |
+ test("mapped stream timeout", () { |
StreamController c = new StreamController(); |
Stream tos = c.stream.map((x) => 2 * x).timeout(ms5); |
expect(tos.isBroadcast, false); |
tos.handleError(expectAsync((e, s) { |
expect(e, new isInstanceOf<TimeoutException>()); |
expect(s, null); |
- })).listen((v){ fail("Unexpected event"); }); |
+ })).listen((v) { |
+ fail("Unexpected event"); |
+ }); |
}); |
test("events prevent timeout", () { |
@@ -110,7 +122,7 @@ main() { |
}); |
// Start the periodic timer before we start listening to the stream. |
// This should reduce the flakiness of the test. |
- int ctr = 200; // send this many events at 5ms intervals. Then close. |
+ int ctr = 200; // send this many events at 5ms intervals. Then close. |
new Timer.periodic(ms5, (timer) { |
sw.reset(); |
c.add(42); |
@@ -121,7 +133,9 @@ main() { |
}); |
sw.start(); |
- tos.listen((v) { expect(v, 42);}, onDone: expectAsync((){})); |
+ tos.listen((v) { |
+ expect(v, 42); |
+ }, onDone: expectAsync(() {})); |
}); |
test("errors prevent timeout", () { |
@@ -140,7 +154,7 @@ main() { |
// Start the periodic timer before we start listening to the stream. |
// This should reduce the flakiness of the test. |
- int ctr = 200; // send this many error events at 5ms intervals. Then close. |
+ int ctr = 200; // send this many error events at 5ms intervals. Then close. |
new Timer.periodic(ms5, (timer) { |
sw.reset(); |
c.addError("ERROR"); |
@@ -151,11 +165,9 @@ main() { |
}); |
sw.start(); |
- tos.listen((_) {}, |
- onError: (e, s) { |
- expect(e, "ERROR"); |
- }, |
- onDone: expectAsync((){})); |
+ tos.listen((_) {}, onError: (e, s) { |
+ expect(e, "ERROR"); |
+ }, onDone: expectAsync(() {})); |
}); |
test("closing prevents timeout", () { |
@@ -163,7 +175,7 @@ main() { |
Stream tos = c.stream.timeout(twoSecs, onTimeout: (_) { |
fail("Timeout not prevented by close"); |
}); |
- tos.listen((_) {}, onDone: expectAsync((){})); |
+ tos.listen((_) {}, onDone: expectAsync(() {})); |
c.close(); |
}); |
@@ -172,7 +184,7 @@ main() { |
Stream tos = c.stream.timeout(ms5, onTimeout: (_) { |
fail("Timeout not prevented by close"); |
}); |
- var subscription = tos.listen((_) {}, onDone: expectAsync((){})); |
+ var subscription = tos.listen((_) {}, onDone: expectAsync(() {})); |
subscription.pause(); |
new Timer(twoSecs, () { |
c.close(); |