Chromium Code Reviews| Index: tests/lib/async/stream_periodic6_test.dart |
| diff --git a/tests/lib/async/stream_periodic_test.dart b/tests/lib/async/stream_periodic6_test.dart |
| similarity index 56% |
| copy from tests/lib/async/stream_periodic_test.dart |
| copy to tests/lib/async/stream_periodic6_test.dart |
| index b333966065bd78c19ff70e73ec83c92227443e96..1d4ffa332b05adc41b2fd3dfe73eaef735d2c1e5 100644 |
| --- a/tests/lib/async/stream_periodic_test.dart |
| +++ b/tests/lib/async/stream_periodic6_test.dart |
| @@ -10,13 +10,20 @@ import 'package:unittest/unittest.dart'; |
| main() { |
| test("stream-periodic1", () { |
| - Stream stream = new Stream.periodic(const Duration(milliseconds: 1)); |
| - int receivedCount = 0; |
| + Stream stream = new Stream.periodic(const Duration(milliseconds: 1), |
| + (i) { |
| + if (i == 3) throw 42; |
| + return i; |
| + }); |
| + int expected = 0; |
| var subscription; |
| subscription = stream.listen(expectAsync((data) { |
| - expect(data, isNull); |
| - receivedCount++; |
| - if (receivedCount == 5) subscription.cancel(); |
| - }, count: 5)); |
| + expect(data, expected++); |
| + if (expected == 5) subscription.cancel(); |
| + }, count: 4), |
| + onError: expectAsync((e, s) { |
| + expect(e, 42); |
|
floitsch
2015/10/31 00:10:08
maybe also check, that expected == 3.
Not necessar
Lasse Reichstein Nielsen
2015/10/31 11:09:10
I think the expectAsync ensures that the function
floitsch
2015/10/31 19:51:30
Right. Missed that one...
|
| + expected++; |
| + })); |
| }); |
| } |