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'; |
11 | 11 |
12 void main() { | 12 void main() { |
13 initUtils(); | |
14 | |
15 test('isEmpty', () { | 13 test('isEmpty', () { |
16 shouldPass([], isEmpty); | 14 shouldPass([], isEmpty); |
17 shouldFail([1], isEmpty, "Expected: empty Actual: [1]"); | 15 shouldFail([1], isEmpty, "Expected: empty Actual: [1]"); |
18 }); | 16 }); |
19 | 17 |
20 test('isNotEmpty', () { | 18 test('isNotEmpty', () { |
21 shouldFail([], isNotEmpty, "Expected: non-empty Actual: []"); | 19 shouldFail([], isNotEmpty, "Expected: non-empty Actual: []"); |
22 shouldPass([1], isNotEmpty); | 20 shouldPass([1], isNotEmpty); |
23 }); | 21 }); |
24 | 22 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 "Expected: pairwise less than [1, 4, 9] " | 155 "Expected: pairwise less than [1, 4, 9] " |
158 "Actual: [1, 2, 3] " | 156 "Actual: [1, 2, 3] " |
159 "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"); |
160 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")); |
161 shouldFail(d, pairwiseCompare(e, (e, a) => a + a == e, "double"), | 159 shouldFail(d, pairwiseCompare(e, (e, a) => a + a == e, "double"), |
162 "Expected: pairwise double [1, 4, 9] " | 160 "Expected: pairwise double [1, 4, 9] " |
163 "Actual: [1, 2, 3] " | 161 "Actual: [1, 2, 3] " |
164 "Which: has <1> which is not double <1> at index 0"); | 162 "Which: has <1> which is not double <1> at index 0"); |
165 }); | 163 }); |
166 } | 164 } |
OLD | NEW |