OLD | NEW |
---|---|
(Empty) | |
1 import 'dart:collection'; | |
2 import 'package:expect/expect.dart'; | |
3 | |
4 class MyList extends ListBase { | |
5 int get length => 4; | |
6 set length(int x) {} | |
7 int operator[](int x) => 42; | |
8 void operator[]=(int x, val) {} | |
9 } | |
10 | |
11 main() { | |
12 var x = new MyList(); | |
13 int z = 0; | |
14 x.forEach((y) { z += y; }); | |
15 Expect.equals(z, 4 * 42); | |
16 } | |
OLD | NEW |