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 part of unittest.matcher; | 5 part of unittest.matcher; |
6 | 6 |
7 /** | 7 /** |
8 * Returns a matcher which matches [Iterable]s in which all elements | 8 * Returns a matcher which matches [Iterable]s in which all elements |
9 * match the given [matcher]. | 9 * match the given [matcher]. |
10 */ | 10 */ |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 abstract class _IterableMatcher extends Matcher { | 138 abstract class _IterableMatcher extends Matcher { |
139 const _IterableMatcher(); | 139 const _IterableMatcher(); |
140 Description describeMismatch(item, Description mismatchDescription, | 140 Description describeMismatch(item, Description mismatchDescription, |
141 Map matchState, bool verbose) { | 141 Map matchState, bool verbose) { |
142 if (item is! Iterable) { | 142 if (item is! Iterable) { |
143 return mismatchDescription. | 143 return mismatchDescription. |
144 addDescriptionOf(item). | 144 addDescriptionOf(item). |
145 add(' not an Iterable'); | 145 add(' not an Iterable'); |
146 } else { | 146 } else { |
147 return super.describeMismatch(item, mismatchDescription, matchState, | 147 return super.describeMismatch(item, mismatchDescription, matchState, |
148 verbose); | 148 verbose); |
149 } | 149 } |
150 } | 150 } |
151 } | 151 } |
152 | 152 |
153 /** | 153 /** |
154 * Returns a matcher which matches [Iterable]s whose elements match the matchers | 154 * Returns a matcher which matches [Iterable]s whose elements match the matchers |
155 * in [expected], but not necessarily in the same order. | 155 * in [expected], but not necessarily in the same order. |
156 * | 156 * |
157 * Note that this is `O(n^2)` and so should only be used on small objects. | 157 * Note that this is `O(n^2)` and so should only be used on small objects. |
158 */ | 158 */ |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 return mismatchDescription. | 265 return mismatchDescription. |
266 add('has '). | 266 add('has '). |
267 addDescriptionOf(matchState["actual"]). | 267 addDescriptionOf(matchState["actual"]). |
268 add(' which is not $_description '). | 268 add(' which is not $_description '). |
269 addDescriptionOf(matchState["expected"]). | 269 addDescriptionOf(matchState["expected"]). |
270 add(' at index ${matchState["index"]}'); | 270 add(' at index ${matchState["index"]}'); |
271 } | 271 } |
272 } | 272 } |
273 } | 273 } |
274 | 274 |
OLD | NEW |