| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 | |
| 7 class A extends Iterable { | 5 class A extends Iterable { |
| 8 int count; | 6 int count; |
| 9 A(this.count); | 7 A(this.count); |
| 10 | 8 |
| 11 Iterator get iterator { | 9 Iterator get iterator { |
| 12 return new AIterator(count); | 10 return new AIterator(count); |
| 13 } | 11 } |
| 14 } | 12 } |
| 15 | 13 |
| 16 class AIterator implements Iterator { | 14 class AIterator implements Iterator { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 34 | 32 |
| 35 main() { | 33 main() { |
| 36 var a = new A(10); | 34 var a = new A(10); |
| 37 Expect.equals(10, a.length); | 35 Expect.equals(10, a.length); |
| 38 a = new A(0); | 36 a = new A(0); |
| 39 Expect.equals(0, a.length); | 37 Expect.equals(0, a.length); |
| 40 a = new A(5); | 38 a = new A(5); |
| 41 Expect.equals(5, a.map((e) => e + 1).length); | 39 Expect.equals(5, a.map((e) => e + 1).length); |
| 42 Expect.equals(3, a.where((e) => e >= 3).length); | 40 Expect.equals(3, a.where((e) => e >= 3).length); |
| 43 } | 41 } |
| OLD | NEW |