Index: pkg/sequence_zip/test/stream_test.dart |
diff --git a/pkg/sequence_zip/test/stream_test.dart b/pkg/sequence_zip/test/stream_test.dart |
index c3e82b8172810d2386da05172c86487087fbe18d..66a5d6252aaec39da6e08d281828a75b6073d524 100644 |
--- a/pkg/sequence_zip/test/stream_test.dart |
+++ b/pkg/sequence_zip/test/stream_test.dart |
@@ -141,15 +141,19 @@ main() { |
test("Error after first end", () { |
StreamController controller = new StreamController(); |
controller..add(7)..add(8)..add(9); |
- testZip([mks([1, 2, 3]), |
- mks([4, 5, 6]), |
+ int ctr = 2; |
+ Function addErrorIf(x) { |
+ return (y) { |
+ // Adds error to controller after both of the first two streams have |
+ // provided all three elements. |
+ if (x == y && --ctr == 0) Timer.run(() { controller.addError("BAD"); }); |
+ return y; |
+ }; |
+ } |
+ testZip([mks([1, 2, 3].map(addErrorIf(3))), |
+ mks([4, 5, 6].map(addErrorIf(6))), |
controller.stream], |
[[1, 4, 7], [2, 5, 8], [3, 6, 9]]); |
- // This comes after the first three events in all cases, since they |
- // use durations no greater than 10 ms. |
- new Timer(const Duration(milliseconds: 100), () { |
- controller.addError("BAD"); |
- }); |
}); |
test("Pause/Resume", () { |