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 /** | 5 /** |
6 * Returns a matcher which matches maps containing the given [value]. | 6 * Returns a matcher which matches maps containing the given [value]. |
7 */ | 7 */ |
8 | 8 |
9 part of unittest; | 9 part of matcher; |
10 | 10 |
11 Matcher containsValue(value) => new _ContainsValue(value); | 11 Matcher containsValue(value) => new _ContainsValue(value); |
12 | 12 |
13 class _ContainsValue extends BaseMatcher { | 13 class _ContainsValue extends BaseMatcher { |
14 final _value; | 14 final _value; |
15 | 15 |
16 const _ContainsValue(this._value); | 16 const _ContainsValue(this._value); |
17 | 17 |
18 bool matches(item, MatchState matchState) => item.containsValue(_value); | 18 bool matches(item, MatchState matchState) => item.containsValue(_value); |
19 Description describe(Description description) => | 19 Description describe(Description description) => |
(...skipping 29 matching lines...) Expand all Loading... |
49 add(" doesn't contain key ").addDescriptionOf(_key); | 49 add(" doesn't contain key ").addDescriptionOf(_key); |
50 } else { | 50 } else { |
51 mismatchDescription.add(' contains key ').addDescriptionOf(_key). | 51 mismatchDescription.add(' contains key ').addDescriptionOf(_key). |
52 add(' but with value '); | 52 add(' but with value '); |
53 _valueMatcher.describeMismatch(item[_key], mismatchDescription, | 53 _valueMatcher.describeMismatch(item[_key], mismatchDescription, |
54 matchState, verbose); | 54 matchState, verbose); |
55 return mismatchDescription; | 55 return mismatchDescription; |
56 } | 56 } |
57 } | 57 } |
58 } | 58 } |
OLD | NEW |