| 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 | 5 |
| 6 main() { | 6 main() { |
| 7 testOperations(); | 7 testOperations(); |
| 8 } | 8 } |
| 9 | 9 |
| 10 class ThrowMarker { | 10 class ThrowMarker { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 try { | 88 try { |
| 89 actual = operation(reversed); | 89 actual = operation(reversed); |
| 90 } catch (e) { | 90 } catch (e) { |
| 91 actual = throws; | 91 actual = throws; |
| 92 } | 92 } |
| 93 testEquals(expect, actual, "$name: $list"); | 93 testEquals(expect, actual, "$name: $list"); |
| 94 } | 94 } |
| 95 testOp((i) => i.first, "first"); | 95 testOp((i) => i.first, "first"); |
| 96 testOp((i) => i.last, "last"); | 96 testOp((i) => i.last, "last"); |
| 97 testOp((i) => i.single, "single"); | 97 testOp((i) => i.single, "single"); |
| 98 testOp((i) => i.firstMatching((n) => false), "firstMatching<false"); | 98 testOp((i) => i.firstWhere((n) => false), "firstWhere<false"); |
| 99 testOp((i) => i.firstMatching((n) => n < 10), "firstMatching<10"); | 99 testOp((i) => i.firstWhere((n) => n < 10), "firstWhere<10"); |
| 100 testOp((i) => i.firstMatching((n) => n < 5), "firstMatching<5"); | 100 testOp((i) => i.firstWhere((n) => n < 5), "firstWhere<5"); |
| 101 testOp((i) => i.firstMatching((n) => true), "firstMatching<true"); | 101 testOp((i) => i.firstWhere((n) => true), "firstWhere<true"); |
| 102 testOp((i) => i.lastMatching((n) => false), "lastMatching<false"); | 102 testOp((i) => i.lastWhere((n) => false), "lastWhere<false"); |
| 103 testOp((i) => i.lastMatching((n) => n < 5), "lastMatching<5"); | 103 testOp((i) => i.lastWhere((n) => n < 5), "lastWhere<5"); |
| 104 testOp((i) => i.lastMatching((n) => n < 10), "lastMatching<10"); | 104 testOp((i) => i.lastWhere((n) => n < 10), "lastWhere<10"); |
| 105 testOp((i) => i.lastMatching((n) => true), "lastMatching<true"); | 105 testOp((i) => i.lastWhere((n) => true), "lastWhere<true"); |
| 106 testOp((i) => i.singleMatching((n) => false), "singleMatching<false"); | 106 testOp((i) => i.singleWhere((n) => false), "singleWhere<false"); |
| 107 testOp((i) => i.singleMatching((n) => n < 5), "singelMatching<5"); | 107 testOp((i) => i.singleWhere((n) => n < 5), "singelWhere<5"); |
| 108 testOp((i) => i.singleMatching((n) => n < 10), "singelMatching<10"); | 108 testOp((i) => i.singleWhere((n) => n < 10), "singelWhere<10"); |
| 109 testOp((i) => i.singleMatching((n) => true), "singleMatching<true"); | 109 testOp((i) => i.singleWhere((n) => true), "singleWhere<true"); |
| 110 testOp((i) => i.contains(5), "contains(5)"); | 110 testOp((i) => i.contains(5), "contains(5)"); |
| 111 testOp((i) => i.contains(10), "contains(10)"); | 111 testOp((i) => i.contains(10), "contains(10)"); |
| 112 testOp((i) => i.any((n) => n < 5), "any<5"); | 112 testOp((i) => i.any((n) => n < 5), "any<5"); |
| 113 testOp((i) => i.any((n) => n < 10), "any<10"); | 113 testOp((i) => i.any((n) => n < 10), "any<10"); |
| 114 testOp((i) => i.every((n) => n < 5), "every<5"); | 114 testOp((i) => i.every((n) => n < 5), "every<5"); |
| 115 testOp((i) => i.every((n) => n < 10), "every<10"); | 115 testOp((i) => i.every((n) => n < 10), "every<10"); |
| 116 testOp((i) => i.max(), "max"); | 116 testOp((i) => i.max(), "max"); |
| 117 testOp((i) => i.min(), "min"); | 117 testOp((i) => i.min(), "min"); |
| 118 testOp((i) => i.reduce(0, (a, b) => a + b), "reduce-sum"); | 118 testOp((i) => i.reduce(0, (a, b) => a + b), "reduce-sum"); |
| 119 testOp((i) => i.join("-"), "join-"); | 119 testOp((i) => i.join("-"), "join-"); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 testList([0, 1, 2, 3]); | 155 testList([0, 1, 2, 3]); |
| 156 testList([3, 4, 5, 6]); | 156 testList([3, 4, 5, 6]); |
| 157 testList([10, 11, 12, 13]); | 157 testList([10, 11, 12, 13]); |
| 158 testList(l); | 158 testList(l); |
| 159 testList(r); | 159 testList(r); |
| 160 testList(base); | 160 testList(base); |
| 161 | 161 |
| 162 // Reverse const list. | 162 // Reverse const list. |
| 163 Expect.listEquals(r, l.map(rev).toList()); | 163 Expect.listEquals(r, l.map(rev).toList()); |
| 164 } | 164 } |
| OLD | NEW |