Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1484)

Unified Diff: tests/lib/async/stream_from_iterable_test.dart

Issue 11880019: Avoid the _onSubscriptionStateChange being called twice in some cases. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Make single-stream not paused when it's closed. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/async/stream_impl.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/async/stream_from_iterable_test.dart
diff --git a/tests/lib/async/stream_from_iterable_test.dart b/tests/lib/async/stream_from_iterable_test.dart
index 4afd889b7523c643b145f6c33b2109480f696de4..f724bf4b6114e366bf533a0a4e6e9ed934cc4de0 100644
--- a/tests/lib/async/stream_from_iterable_test.dart
+++ b/tests/lib/async/stream_from_iterable_test.dart
@@ -36,21 +36,26 @@ main() {
.mappedBy((i) => "$i")).run();
Iterable<int> iter = new Iterable.generate(25, (i) => i * 2);
- new Stream.fromIterable(iter).toList().then(expectAsync1((actual) {
- List expected = iter.toList();
- Expect.equals(25, expected.length);
- Expect.listEquals(expected, actual);
- }));
- new Stream.fromIterable(iter)
- .mappedBy((i) => i * 3)
- .toList()
- .then(expectAsync1((actual) {
- List expected = iter.mappedBy((i) => i * 3).toList();
- Expect.listEquals(expected, actual);
+ test("iterable-toList", () {
+ new Stream.fromIterable(iter).toList().then(expectAsync1((actual) {
+ List expected = iter.toList();
+ Expect.equals(25, expected.length);
+ Expect.listEquals(expected, actual);
}));
+ });
- { // Test pause.
+ test("iterable-mapped-toList", () {
+ new Stream.fromIterable(iter)
+ .mappedBy((i) => i * 3)
+ .toList()
+ .then(expectAsync1((actual) {
+ List expected = iter.mappedBy((i) => i * 3).toList();
+ Expect.listEquals(expected, actual);
+ }));
+ });
+
+ test("iterable-paused", () {
Stream stream = new Stream.fromIterable(iter);
Events actual = new Events();
StreamSubscription subscription;
@@ -63,5 +68,5 @@ main() {
Events expected = new Events.fromIterable(iter);
Expect.listEquals(expected.events, actual.events);
}));
- }
+ });
}
« no previous file with comments | « sdk/lib/async/stream_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698