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 if the match argument is a string and | 6 * Returns a matcher which matches if the match argument is a string and |
7 * is equal to [value] when compared case-insensitively. | 7 * is equal to [value] when compared case-insensitively. |
8 */ | 8 */ |
9 Matcher equalsIgnoringCase(String value) => new _IsEqualIgnoringCase(value); | 9 Matcher equalsIgnoringCase(String value) => new _IsEqualIgnoringCase(value); |
10 | 10 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 } | 171 } |
172 | 172 |
173 bool matches(String item) => _regexp.hasMatch(item); | 173 bool matches(String item) => _regexp.hasMatch(item); |
174 | 174 |
175 Description describe(Description description) => | 175 Description describe(Description description) => |
176 description.add("match '${_regexp.pattern}'"); | 176 description.add("match '${_regexp.pattern}'"); |
177 } | 177 } |
178 | 178 |
179 // String matchers match against a string. We add this intermediate | 179 // String matchers match against a string. We add this intermediate |
180 // class to give better mismatch error messages than the base Matcher class. | 180 // class to give better mismatch error messages than the base Matcher class. |
181 /*abstract*/ class _StringMatcher extends BaseMatcher { | 181 /* abstract */ class _StringMatcher extends BaseMatcher { |
182 const _StringMatcher(); | 182 const _StringMatcher(); |
183 Description describeMismatch(item, Description mismatchDescription) { | 183 Description describeMismatch(item, Description mismatchDescription) { |
184 if (!(item is String)) { | 184 if (!(item is String)) { |
185 return mismatchDescription. | 185 return mismatchDescription. |
186 addDescriptionOf(item). | 186 addDescriptionOf(item). |
187 add(' not a string'); | 187 add(' not a string'); |
188 } else { | 188 } else { |
189 return super.describeMismatch(item, mismatchDescription); | 189 return super.describeMismatch(item, mismatchDescription); |
190 } | 190 } |
191 } | 191 } |
192 } | 192 } |
OLD | NEW |