OLD | NEW |
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 file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
| 5 import 'package:expect/expect.dart'; |
| 6 |
5 Iterable<int> foo() sync* { | 7 Iterable<int> foo() sync* { |
6 yield 1; | 8 yield 1; |
7 yield* [2, 3]; | 9 yield* [2, 3]; |
8 } | 10 } |
9 | 11 |
10 class Class { | 12 class Class { |
11 Iterable<int> bar() sync* { | 13 Iterable<int> bar() sync* { |
12 yield 1; | 14 yield 1; |
13 yield* [2, 3]; | 15 yield* [2, 3]; |
14 } | 16 } |
15 | 17 |
16 static Iterable<int> baz() sync* { | 18 static Iterable<int> baz() sync* { |
17 yield 1; | 19 yield 1; |
18 yield* [2, 3]; | 20 yield* [2, 3]; |
19 } | 21 } |
20 } | 22 } |
21 | 23 |
22 main() { | 24 main() { |
23 Iterable<int> qux() sync* { | 25 Iterable<int> qux() sync* { |
24 yield 1; | 26 yield 1; |
25 yield* [2, 3]; | 27 yield* [2, 3]; |
26 } | 28 } |
27 | 29 |
28 foo().forEach(print); | 30 Expect.listEquals([1, 2, 3], foo().toList()); |
29 new Class().bar().forEach(print); | 31 Expect.listEquals([1, 2, 3], new Class().bar().toList()); |
30 Class.baz().forEach(print); | 32 Expect.listEquals([1, 2, 3], Class.baz().toList()); |
31 qux().forEach(print); | 33 Expect.listEquals([1, 2, 3], qux().toList()); |
32 } | 34 } |
OLD | NEW |