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.core_matchers_test; | 5 library matcher.core_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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 }); | 48 }); |
49 | 49 |
50 test('equals with a set', () { | 50 test('equals with a set', () { |
51 var numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; | 51 var numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; |
52 var set1 = numbers.toSet(); | 52 var set1 = numbers.toSet(); |
53 numbers.shuffle(); | 53 numbers.shuffle(); |
54 var set2 = numbers.toSet(); | 54 var set2 = numbers.toSet(); |
55 | 55 |
56 shouldPass(set2, equals(set1)); | 56 shouldPass(set2, equals(set1)); |
57 shouldPass(numbers, equals(set1)); | 57 shouldPass(numbers, equals(set1)); |
58 shouldFail([1, 2, 3, 4, 5, 6, 7, 8, 9], equals(set1), | 58 shouldFail([1, 2, 3, 4, 5, 6, 7, 8, 9], equals(set1), matches( |
59 "Expected: ?:[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n" | 59 r"Expected: .*:\[1, 2, 3, 4, 5, 6, 7, 8, 9, 10\]" |
60 " Actual: [1, 2, 3, 4, 5, 6, 7, 8, 9]\n" | 60 r" Actual: \[1, 2, 3, 4, 5, 6, 7, 8, 9\]" |
61 " Which: does not contain 10"); | 61 r" Which: does not contain 10")); |
62 shouldFail([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], equals(set1), | 62 shouldFail([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], equals(set1), matches( |
63 "Expected: ?:[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n" | 63 r"Expected: .*:\[1, 2, 3, 4, 5, 6, 7, 8, 9, 10\]" |
64 " Actual: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]\n" | 64 r" Actual: \[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11\]" |
65 " Which: larger than expected"); | 65 r" Which: larger than expected")); |
66 }); | 66 }); |
67 | 67 |
68 test('anything', () { | 68 test('anything', () { |
69 var a = new Map(); | 69 var a = new Map(); |
70 shouldPass(0, anything); | 70 shouldPass(0, anything); |
71 shouldPass(null, anything); | 71 shouldPass(null, anything); |
72 shouldPass(a, anything); | 72 shouldPass(a, anything); |
73 shouldFail(a, isNot(anything), "Expected: not anything Actual: {}"); | 73 shouldFail(a, isNot(anything), "Expected: not anything Actual: {}"); |
74 }); | 74 }); |
75 | 75 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 }); | 220 }); |
221 } | 221 } |
222 | 222 |
223 class _Bicycle { | 223 class _Bicycle { |
224 static final foo = bar(); | 224 static final foo = bar(); |
225 | 225 |
226 static bar() { | 226 static bar() { |
227 return foo + 1; | 227 return foo + 1; |
228 } | 228 } |
229 } | 229 } |
OLD | NEW |