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 import "package:expect/expect.dart"; |
| 6 import "package:async_helper/async_helper.dart"; |
| 7 |
| 8 range(start, end) async* { |
| 9 for (int i = start; i < end; i++) { |
| 10 yield i; |
| 11 } |
| 12 } |
| 13 |
| 14 concat(a, b) async* { |
| 15 yield* a; |
| 16 yield* b; |
| 17 } |
| 18 |
| 19 test() async { |
| 20 Expect.listEquals([1, 2, 3, 11, 12, 13], |
| 21 await concat(range(1, 4), range(11, 14)).toList()); |
| 22 } |
| 23 |
| 24 main() { |
| 25 asyncStart(); |
| 26 test().then((_) { |
| 27 asyncEnd(); |
| 28 }); |
| 29 } |
OLD | NEW |