OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // Test merging streams. | 5 // Test merging streams. |
6 library dart.test.stream_from_iterable; | 6 library dart.test.stream_from_iterable; |
7 | 7 |
8 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
9 import "dart:async"; | 9 import "dart:async"; |
10 import '../../../pkg/unittest/lib/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
11 import 'event_helper.dart'; | 11 import 'event_helper.dart'; |
12 | 12 |
13 class IterableTest<T> { | 13 class IterableTest<T> { |
14 static int counter = 0; | 14 static int counter = 0; |
15 Iterable<T> iterable; | 15 Iterable<T> iterable; |
16 IterableTest(this.iterable); | 16 IterableTest(this.iterable); |
17 void run() { | 17 void run() { |
18 test("stream from iterable ${counter++}", () { | 18 test("stream from iterable ${counter++}", () { |
19 Events expected = new Events.fromIterable(iterable); | 19 Events expected = new Events.fromIterable(iterable); |
20 Stream<T> stream = new Stream<T>.fromIterable(iterable); | 20 Stream<T> stream = new Stream<T>.fromIterable(iterable); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 Expect.listEquals([1, 3, 5], data); | 142 Expect.listEquals([1, 3, 5], data); |
143 Expect.listEquals([2, 4], errors); | 143 Expect.listEquals([2, 4], errors); |
144 done(); | 144 done(); |
145 }); | 145 }); |
146 c.addStream(from, cancelOnError: false).then((_) { | 146 c.addStream(from, cancelOnError: false).then((_) { |
147 c.close(); | 147 c.close(); |
148 done(); | 148 done(); |
149 }); | 149 }); |
150 }); | 150 }); |
151 } | 151 } |
OLD | NEW |