| 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(); | 13 initUtils(); |
| 14 | 14 |
| 15 test('isEmpty', () { | 15 test('isEmpty', () { |
| 16 shouldPass([], isEmpty); | 16 shouldPass([], isEmpty); |
| 17 shouldFail([1], isEmpty, "Expected: empty Actual: [1]"); | 17 shouldFail([1], isEmpty, "Expected: empty Actual: [1]"); |
| 18 }); | 18 }); |
| 19 | 19 |
| 20 test('isNotEmpty', () { |
| 21 shouldFail([], isNotEmpty, "Expected: non-empty Actual: []"); |
| 22 shouldPass([1], isNotEmpty); |
| 23 }); |
| 24 |
| 20 test('contains', () { | 25 test('contains', () { |
| 21 var d = [1, 2]; | 26 var d = [1, 2]; |
| 22 shouldPass(d, contains(1)); | 27 shouldPass(d, contains(1)); |
| 23 shouldFail(d, contains(0), "Expected: contains <0> " | 28 shouldFail(d, contains(0), "Expected: contains <0> " |
| 24 "Actual: [1, 2]"); | 29 "Actual: [1, 2]"); |
| 25 }); | 30 }); |
| 26 | 31 |
| 27 test('equals with matcher element', () { | 32 test('equals with matcher element', () { |
| 28 var d = ['foo', 'bar']; | 33 var d = ['foo', 'bar']; |
| 29 shouldPass(d, equals(['foo', startsWith('ba')])); | 34 shouldPass(d, equals(['foo', startsWith('ba')])); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 "Expected: pairwise less than [1, 4, 9] " | 162 "Expected: pairwise less than [1, 4, 9] " |
| 158 "Actual: [1, 2, 3] " | 163 "Actual: [1, 2, 3] " |
| 159 "Which: has <1> which is not less than <1> at index 0"); | 164 "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")); | 165 shouldPass(d, pairwiseCompare(e, (e,a) => a * a == e, "square root of")); |
| 161 shouldFail(d, pairwiseCompare(e, (e,a) => a + a == e, "double"), | 166 shouldFail(d, pairwiseCompare(e, (e,a) => a + a == e, "double"), |
| 162 "Expected: pairwise double [1, 4, 9] " | 167 "Expected: pairwise double [1, 4, 9] " |
| 163 "Actual: [1, 2, 3] " | 168 "Actual: [1, 2, 3] " |
| 164 "Which: has <1> which is not double <1> at index 0"); | 169 "Which: has <1> which is not double <1> at index 0"); |
| 165 }); | 170 }); |
| 166 } | 171 } |
| OLD | NEW |