| 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 29 matching lines...) Expand all Loading... |
| 40 shouldFail(b, same(a), "Expected: same instance as {} Actual: {}"); | 40 shouldFail(b, same(a), "Expected: same instance as {} Actual: {}"); |
| 41 }); | 41 }); |
| 42 | 42 |
| 43 test('equals', () { | 43 test('equals', () { |
| 44 var a = new Map(); | 44 var a = new Map(); |
| 45 var b = new Map(); | 45 var b = new Map(); |
| 46 shouldPass(a, equals(a)); | 46 shouldPass(a, equals(a)); |
| 47 shouldPass(a, equals(b)); | 47 shouldPass(a, equals(b)); |
| 48 }); | 48 }); |
| 49 | 49 |
| 50 test('equals with a set', () { |
| 51 var numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; |
| 52 var set1 = numbers.toSet(); |
| 53 numbers.shuffle(); |
| 54 var set2 = numbers.toSet(); |
| 55 |
| 56 shouldPass(set2, equals(set1)); |
| 57 shouldPass(numbers, equals(set1)); |
| 58 shouldFail([1, 2, 3, 4, 5, 6, 7, 8, 9], equals(set1), |
| 59 "Expected: ?:[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n" |
| 60 " Actual: [1, 2, 3, 4, 5, 6, 7, 8, 9]\n" |
| 61 " Which: does not contain 10"); |
| 62 shouldFail([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], equals(set1), |
| 63 "Expected: ?:[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n" |
| 64 " Actual: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]\n" |
| 65 " Which: larger than expected"); |
| 66 }); |
| 67 |
| 50 test('anything', () { | 68 test('anything', () { |
| 51 var a = new Map(); | 69 var a = new Map(); |
| 52 shouldPass(0, anything); | 70 shouldPass(0, anything); |
| 53 shouldPass(null, anything); | 71 shouldPass(null, anything); |
| 54 shouldPass(a, anything); | 72 shouldPass(a, anything); |
| 55 shouldFail(a, isNot(anything), "Expected: not anything Actual: {}"); | 73 shouldFail(a, isNot(anything), "Expected: not anything Actual: {}"); |
| 56 }); | 74 }); |
| 57 | 75 |
| 58 test('throws', () { | 76 test('throws', () { |
| 59 shouldFail(doesNotThrow, throws, | 77 shouldFail(doesNotThrow, throws, |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 }); | 220 }); |
| 203 } | 221 } |
| 204 | 222 |
| 205 class _Bicycle { | 223 class _Bicycle { |
| 206 static final foo = bar(); | 224 static final foo = bar(); |
| 207 | 225 |
| 208 static bar() { | 226 static bar() { |
| 209 return foo + 1; | 227 return foo + 1; |
| 210 } | 228 } |
| 211 } | 229 } |
| OLD | NEW |