| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 class ListTest { | 5 class ListTest { |
| 6 | 6 |
| 7 static testMain() { | 7 static testMain() { |
| 8 testList(); | 8 testList(); |
| 9 testExpandableList(); | 9 testExpandableList(); |
| 10 } | 10 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 static void testClosures(List list) { | 22 static void testClosures(List list) { |
| 23 testMap(val) {return val * 2 + 10; } | 23 testMap(val) {return val * 2 + 10; } |
| 24 List mapped = list.mappedBy(testMap).toList(); | 24 List mapped = list.mappedBy(testMap).toList(); |
| 25 Expect.equals(mapped.length, list.length); | 25 Expect.equals(mapped.length, list.length); |
| 26 for (var i = 0; i < list.length; i++) { | 26 for (var i = 0; i < list.length; i++) { |
| 27 Expect.equals(mapped[i], list[i]*2 + 10); | 27 Expect.equals(mapped[i], list[i]*2 + 10); |
| 28 } | 28 } |
| 29 | 29 |
| 30 testFilter(val) { return val == 3; } | 30 testFilter(val) { return val == 3; } |
| 31 Collection filtered = list.where(testFilter); | 31 Iterable filtered = list.where(testFilter); |
| 32 Expect.equals(filtered.length, 1); | 32 Expect.equals(filtered.length, 1); |
| 33 | 33 |
| 34 testEvery(val) { return val != 11; } | 34 testEvery(val) { return val != 11; } |
| 35 bool test = list.every(testEvery); | 35 bool test = list.every(testEvery); |
| 36 Expect.equals(true, test); | 36 Expect.equals(true, test); |
| 37 | 37 |
| 38 testSome(val) { return val == 1; } | 38 testSome(val) { return val == 1; } |
| 39 test = list.some(testSome); | 39 test = list.some(testSome); |
| 40 Expect.equals(true, test); | 40 Expect.equals(true, test); |
| 41 | 41 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 } | 143 } |
| 144 } | 144 } |
| 145 | 145 |
| 146 class Yes { | 146 class Yes { |
| 147 operator ==(var other) => true; | 147 operator ==(var other) => true; |
| 148 } | 148 } |
| 149 | 149 |
| 150 main() { | 150 main() { |
| 151 ListTest.testMain(); | 151 ListTest.testMain(); |
| 152 } | 152 } |
| OLD | NEW |