Chromium Code Reviews| 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 that matches empty strings, maps or iterables | 8 * Returns a matcher that matches empty strings, maps or iterables |
| 9 * (including collections). | 9 * (including collections). |
| 10 */ | 10 */ |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 173 } | 173 } |
| 174 } else { | 174 } else { |
| 175 reason = new StringDescription(); | 175 reason = new StringDescription(); |
| 176 var includeTypes = expected.runtimeType != actual.runtimeType; | 176 var includeTypes = expected.runtimeType != actual.runtimeType; |
| 177 // If we have recursed, show the expected value too; if not, | 177 // If we have recursed, show the expected value too; if not, |
| 178 // expect() will show it for us. As expect will not show type | 178 // expect() will show it for us. As expect will not show type |
| 179 // mismatches at the top level we handle those here too. | 179 // mismatches at the top level we handle those here too. |
| 180 if (includeTypes || depth > 1) { | 180 if (includeTypes || depth > 1) { |
| 181 reason.add('expected '); | 181 reason.add('expected '); |
| 182 if (includeTypes) { | 182 if (includeTypes) { |
| 183 reason..add(expected.runtimeType).add(':'); | 183 reason.add(expected.runtimeType.toString()).add(':'); |
| 184 } | 184 } |
| 185 reason.addDescriptionOf(expected).add(' but '); | 185 reason.addDescriptionOf(expected).add(' but '); |
| 186 } | 186 } |
| 187 reason.add('was '); | 187 reason.add('was '); |
| 188 if (includeTypes) { | 188 if (includeTypes) { |
| 189 reason..add(actual.runtimeType).add(':'); | 189 reason..add(actual.runtimeType.toString()).add(':'); |
|
Siggi Cherem (dart-lang)
2013/02/12 21:23:52
.. to .? or change the one in 183 to be .. as well
gram
2013/02/12 21:25:41
Done.
| |
| 190 } | 190 } |
| 191 reason.addDescriptionOf(actual); | 191 reason.addDescriptionOf(actual); |
| 192 } | 192 } |
| 193 } | 193 } |
| 194 if (reason != null && location.length > 0) { | 194 if (reason != null && location.length > 0) { |
| 195 reason.add(' ').add(location); | 195 reason.add(' ').add(location); |
| 196 } | 196 } |
| 197 return reason; | 197 return reason; |
| 198 } | 198 } |
| 199 | 199 |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 722 description.add(_featureDescription).add(' ').addDescriptionOf(_matcher); | 722 description.add(_featureDescription).add(' ').addDescriptionOf(_matcher); |
| 723 | 723 |
| 724 Description describeMismatch(item, Description mismatchDescription, | 724 Description describeMismatch(item, Description mismatchDescription, |
| 725 MatchState matchState, bool verbose) { | 725 MatchState matchState, bool verbose) { |
| 726 mismatchDescription.add(_featureName).add(' '); | 726 mismatchDescription.add(_featureName).add(' '); |
| 727 _matcher.describeMismatch(matchState.state['feature'], mismatchDescription, | 727 _matcher.describeMismatch(matchState.state['feature'], mismatchDescription, |
| 728 matchState.state['innerState'], verbose); | 728 matchState.state['innerState'], verbose); |
| 729 return mismatchDescription; | 729 return mismatchDescription; |
| 730 } | 730 } |
| 731 } | 731 } |
| OLD | NEW |