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 library matcher.iterable_matchers_test; | 5 library matcher.iterable_matchers_test; |
6 | 6 |
7 import 'package:matcher/matcher.dart'; | 7 import 'package:matcher/matcher.dart'; |
8 import 'package:unittest/unittest.dart' show test, group; | 8 import 'package:unittest/unittest.dart' show test, group; |
9 | 9 |
10 import 'test_utils.dart'; | 10 import 'test_utils.dart'; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 shouldFail(d, pairwiseCompare(e, (e, a) => a < e, "less than"), | 154 shouldFail(d, pairwiseCompare(e, (e, a) => a < e, "less than"), |
155 "Expected: pairwise less than [1, 4, 9] " | 155 "Expected: pairwise less than [1, 4, 9] " |
156 "Actual: [1, 2, 3] " | 156 "Actual: [1, 2, 3] " |
157 "Which: has <1> which is not less than <1> at index 0"); | 157 "Which: has <1> which is not less than <1> at index 0"); |
158 shouldPass(d, pairwiseCompare(e, (e, a) => a * a == e, "square root of")); | 158 shouldPass(d, pairwiseCompare(e, (e, a) => a * a == e, "square root of")); |
159 shouldFail(d, pairwiseCompare(e, (e, a) => a + a == e, "double"), | 159 shouldFail(d, pairwiseCompare(e, (e, a) => a + a == e, "double"), |
160 "Expected: pairwise double [1, 4, 9] " | 160 "Expected: pairwise double [1, 4, 9] " |
161 "Actual: [1, 2, 3] " | 161 "Actual: [1, 2, 3] " |
162 "Which: has <1> which is not double <1> at index 0"); | 162 "Which: has <1> which is not double <1> at index 0"); |
163 }); | 163 }); |
| 164 |
| 165 test('isEmpty', () { |
| 166 var d = new SimpleIterable(0); |
| 167 var e = new SimpleIterable(1); |
| 168 shouldPass(d, isEmpty); |
| 169 shouldFail(e, isEmpty, "Expected: empty " |
| 170 "Actual: SimpleIterable:[1]"); |
| 171 }); |
| 172 |
| 173 test('isNotEmpty', () { |
| 174 var d = new SimpleIterable(0); |
| 175 var e = new SimpleIterable(1); |
| 176 shouldPass(e, isNotEmpty); |
| 177 shouldFail(d, isNotEmpty, "Expected: non-empty " |
| 178 "Actual: SimpleIterable:[]"); |
| 179 }); |
| 180 |
| 181 test('contains', () { |
| 182 var d = new SimpleIterable(3); |
| 183 shouldPass(d, contains(2)); |
| 184 shouldFail(d, contains(5), "Expected: contains <5> " |
| 185 "Actual: SimpleIterable:[3, 2, 1]"); |
| 186 }); |
164 } | 187 } |
OLD | NEW |