OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 // Tests the StreamView class. |
| 6 |
| 7 import "package:expect/expect.dart"; |
| 8 import "dart:async"; |
| 9 import "package:async_helper/async_helper.dart"; |
| 10 |
| 11 main() { |
| 12 asyncStart(); |
| 13 runTest().whenComplete(asyncEnd); |
| 14 } |
| 15 |
| 16 Future runTest() async { |
| 17 unreachable([a,b]) { throw "UNREACHABLE"; } |
| 18 int tick = 0; |
| 19 ticker() { tick++; } |
| 20 |
| 21 asyncStart(); |
| 22 |
| 23 // Is const constructor. |
| 24 Stream<int> s = const StreamView<int>(const Stream<int>.empty()); |
| 25 |
| 26 Expect.isFalse(s is Stream<String>); // Respects type parameter. |
| 27 StreamSubscription<int> sub = |
| 28 s.listen(unreachable, onError: unreachable, onDone: ticker); |
| 29 Expect.isFalse(sub is StreamSubscription<String>); // Type parameter in sub. |
| 30 |
| 31 Stream iterableStream = new Stream.fromIterable([1, 2, 3]); |
| 32 Expect.listEquals([1, 2, 3], await iterableStream.toList()); |
| 33 |
| 34 asyncEnd(); |
| 35 } |
| 36 |
| 37 Future flushMicrotasks() => new Future.delayed(Duration.ZERO); |
OLD | NEW |