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

Side by Side Diff: test/stream_queue_test.dart

Issue 1219683012: Fix syntax error which was accepted by the VM. (Closed) Base URL: https://github.com/dart-lang/async@master
Patch Set: Created 5 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE filevents. 3 // BSD-style license that can be found in the LICENSE filevents.
4 4
5 import "dart:async"; 5 import "dart:async";
6 6
7 import "package:async/async.dart" show StreamQueue; 7 import "package:async/async.dart" show StreamQueue;
8 import "package:test/test.dart"; 8 import "package:test/test.dart";
9 9
10 import "utils.dart"; 10 import "utils.dart";
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 expect(await events.next, 4); 135 expect(await events.next, 4);
136 await events.cancel(); 136 await events.cancel();
137 }); 137 });
138 138
139 test("of events with error, and skip again after", () async { 139 test("of events with error, and skip again after", () async {
140 var events = new StreamQueue<int>(createErrorStream()); 140 var events = new StreamQueue<int>(createErrorStream());
141 expect(events.skip(4), throwsA("To err is divine!")); 141 expect(events.skip(4), throwsA("To err is divine!"));
142 expect(events.skip(2), completion(1)); 142 expect(events.skip(2), completion(1));
143 await events.cancel(); 143 await events.cancel();
144 }); 144 });
145
146 test("multiple skips at same time complete in order.", () async { 145 test("multiple skips at same time complete in order.", () async {
147 var events = new StreamQueue<int>(createStream()); 146 var events = new StreamQueue<int>(createStream());
148 var skip1 = events.skip(1); 147 var skip1 = events.skip(1);
149 var skip2 = events.skip(0); 148 var skip2 = events.skip(0);
150 var skip3 = events.skip(4); 149 var skip3 = events.skip(4);
151 var skip4 = events.skip(1); 150 var skip4 = events.skip(1);
152 var index = 0; 151 var index = 0;
153 // Check that futures complete in order. 152 // Check that futures complete in order.
154 sequence(expectedValue, sequenceIndex) => (value) { 153 sequence(expectedValue, sequenceIndex) => (value) {
155 expect(value, expectedValue); 154 expect(value, expectedValue);
156 expect(index, sequenceIndex); 155 expect(index, sequenceIndex);
157 index++; 156 index++;
158 } 157 };
159 await Future.wait([skip1.then(sequence(0, 0)), 158 await Future.wait([skip1.then(sequence(0, 0)),
160 skip2.then(sequence(0, 1)), 159 skip2.then(sequence(0, 1)),
161 skip3.then(sequence(1, 2)), 160 skip3.then(sequence(1, 2)),
162 skip4.then(sequence(1, 3))]); 161 skip4.then(sequence(1, 3))]);
163 await events.cancel(); 162 await events.cancel();
164 }); 163 });
165 }); 164 });
166 165
167 group("take operation", () { 166 group("take operation", () {
168 test("as simple take of events", () async { 167 test("as simple take of events", () async {
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 controller.add(4); 622 controller.add(4);
624 await flushMicrotasks(); 623 await flushMicrotasks();
625 controller.close(); 624 controller.close();
626 }(); 625 }();
627 return controller.stream; 626 return controller.stream;
628 } 627 }
629 628
630 Stream<int> createLongStream(int eventCount) async* { 629 Stream<int> createLongStream(int eventCount) async* {
631 for (int i = 0; i < eventCount; i++) yield i; 630 for (int i = 0; i < eventCount; i++) yield i;
632 } 631 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698