| 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 matcher; | 5 part of matcher; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Returns a matcher which matches [Collection]s in which all elements | 8 * Returns a matcher which matches [Collection]s in which all elements |
| 9 * match the given [matcher]. | 9 * match the given [matcher]. |
| 10 */ | 10 */ |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 } else { | 135 } else { |
| 136 for (var element in item) { | 136 for (var element in item) { |
| 137 ++actualLength; | 137 ++actualLength; |
| 138 } | 138 } |
| 139 } | 139 } |
| 140 if (expectedLength > actualLength) { | 140 if (expectedLength > actualLength) { |
| 141 return 'has too few elements (${actualLength} < ${expectedLength})'; | 141 return 'has too few elements (${actualLength} < ${expectedLength})'; |
| 142 } else if (expectedLength < actualLength) { | 142 } else if (expectedLength < actualLength) { |
| 143 return 'has too many elements (${actualLength} > ${expectedLength})'; | 143 return 'has too many elements (${actualLength} > ${expectedLength})'; |
| 144 } | 144 } |
| 145 List<bool> matched = new List<bool>.fixedLength(actualLength); | 145 List<bool> matched = new List<bool>(actualLength); |
| 146 for (var i = 0; i < actualLength; i++) { | 146 for (var i = 0; i < actualLength; i++) { |
| 147 matched[i] = false; | 147 matched[i] = false; |
| 148 } | 148 } |
| 149 var expectedPosition = 0; | 149 var expectedPosition = 0; |
| 150 for (var expectedElement in _expected) { | 150 for (var expectedElement in _expected) { |
| 151 var actualPosition = 0; | 151 var actualPosition = 0; |
| 152 var gotMatch = false; | 152 var gotMatch = false; |
| 153 for (var actualElement in item) { | 153 for (var actualElement in item) { |
| 154 if (!matched[actualPosition]) { | 154 if (!matched[actualPosition]) { |
| 155 if (expectedElement == actualElement) { | 155 if (expectedElement == actualElement) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 if (item is !Collection) { | 192 if (item is !Collection) { |
| 193 return mismatchDescription. | 193 return mismatchDescription. |
| 194 addDescriptionOf(item). | 194 addDescriptionOf(item). |
| 195 add(' not a collection'); | 195 add(' not a collection'); |
| 196 } else { | 196 } else { |
| 197 return super.describeMismatch(item, mismatchDescription, matchState, | 197 return super.describeMismatch(item, mismatchDescription, matchState, |
| 198 verbose); | 198 verbose); |
| 199 } | 199 } |
| 200 } | 200 } |
| 201 } | 201 } |
| OLD | NEW |