OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import "package:async/async.dart"; | |
8 import "package:async/src/typed/stream.dart"; | 7 import "package:async/src/typed/stream.dart"; |
9 import "package:test/test.dart"; | 8 import "package:test/test.dart"; |
10 | 9 |
11 import '../utils.dart'; | 10 import '../utils.dart'; |
12 | 11 |
13 void main() { | 12 void main() { |
14 group("with valid types, forwards", () { | 13 group("with valid types, forwards", () { |
15 var controller; | 14 var controller; |
16 var wrapper; | 15 var wrapper; |
17 var emptyWrapper; | 16 var emptyWrapper; |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 expect(wrapper.listen(null).asFuture(), completes); | 237 expect(wrapper.listen(null).asFuture(), completes); |
239 }); | 238 }); |
240 }); | 239 }); |
241 | 240 |
242 test("map()", () { | 241 test("map()", () { |
243 expect(wrapper.map((i) => i * 2).toList(), | 242 expect(wrapper.map((i) => i * 2).toList(), |
244 completion(equals([2, 4, 6, 8, 10]))); | 243 completion(equals([2, 4, 6, 8, 10]))); |
245 }); | 244 }); |
246 | 245 |
247 test("pipe()", () { | 246 test("pipe()", () { |
248 var consumer = new StreamController<T>(); | 247 var consumer = new StreamController(); |
249 expect(wrapper.pipe(consumer), completes); | 248 expect(wrapper.pipe(consumer), completes); |
250 expect(consumer.stream.toList(), completion(equals([1, 2, 3, 4, 5]))); | 249 expect(consumer.stream.toList(), completion(equals([1, 2, 3, 4, 5]))); |
251 }); | 250 }); |
252 | 251 |
253 test("reduce()", () { | 252 test("reduce()", () { |
254 expect(wrapper.reduce((value, i) => value + i), completion(equals(15))); | 253 expect(wrapper.reduce((value, i) => value + i), completion(equals(15))); |
255 expect(emptyWrapper.reduce((value, i) => value + i), throwsStateError); | 254 expect(emptyWrapper.reduce((value, i) => value + i), throwsStateError); |
256 }); | 255 }); |
257 | 256 |
258 test("skipWhile()", () { | 257 test("skipWhile()", () { |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 expect(wrapper.join(" "), completion(equals("foo bar baz"))); | 588 expect(wrapper.join(" "), completion(equals("foo bar baz"))); |
590 }); | 589 }); |
591 }); | 590 }); |
592 | 591 |
593 test("toString()", () { | 592 test("toString()", () { |
594 expect(wrapper.toString(), contains("Stream")); | 593 expect(wrapper.toString(), contains("Stream")); |
595 }); | 594 }); |
596 }); | 595 }); |
597 }); | 596 }); |
598 } | 597 } |
OLD | NEW |