| 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 collections. | 8 * Returns a matcher that matches empty strings, maps or collections. |
| 9 */ | 9 */ |
| 10 const Matcher isEmpty = const _Empty(); | 10 const Matcher isEmpty = const _Empty(); |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 | 458 |
| 459 /** A matcher for functions that throw RangeError. */ | 459 /** A matcher for functions that throw RangeError. */ |
| 460 const Matcher throwsRangeError = | 460 const Matcher throwsRangeError = |
| 461 const Throws(isRangeError); | 461 const Throws(isRangeError); |
| 462 | 462 |
| 463 class _RangeError extends TypeMatcher { | 463 class _RangeError extends TypeMatcher { |
| 464 const _RangeError() : super("RangeError"); | 464 const _RangeError() : super("RangeError"); |
| 465 bool matches(item, MatchState matchState) => item is RangeError; | 465 bool matches(item, MatchState matchState) => item is RangeError; |
| 466 } | 466 } |
| 467 | 467 |
| 468 // Temporary matcher for deprecated IndexOutOfRangeException. |
| 469 /** A matcher for IndexOutOfRangeExceptions. */ |
| 470 const isIndexOutOfRangeException = const _IndexOutOfRangeException(); |
| 471 |
| 472 /** A matcher for functions that throw IndexOutOfRangeException. */ |
| 473 const Matcher throwsIndexOutOfRangeException = |
| 474 const Throws(isIndexOutOfRangeException); |
| 475 |
| 476 class _IndexOutOfRangeException extends TypeMatcher { |
| 477 const _IndexOutOfRangeException() : super("IndexOutOfRangeException"); |
| 478 bool matches(item, MatchState matchState) => item is IndexOutOfRangeException; |
| 479 } |
| 480 |
| 468 /** A matcher for NoSuchMethodErrors. */ | 481 /** A matcher for NoSuchMethodErrors. */ |
| 469 const isNoSuchMethodError = const _NoSuchMethodError(); | 482 const isNoSuchMethodError = const _NoSuchMethodError(); |
| 470 | 483 |
| 471 /** A matcher for functions that throw NoSuchMethodError. */ | 484 /** A matcher for functions that throw NoSuchMethodError. */ |
| 472 const Matcher throwsNoSuchMethodError = | 485 const Matcher throwsNoSuchMethodError = |
| 473 const Throws(isNoSuchMethodError); | 486 const Throws(isNoSuchMethodError); |
| 474 | 487 |
| 475 class _NoSuchMethodError extends TypeMatcher { | 488 class _NoSuchMethodError extends TypeMatcher { |
| 476 const _NoSuchMethodError() : super("NoSuchMethodError"); | 489 const _NoSuchMethodError() : super("NoSuchMethodError"); |
| 477 bool matches(item, MatchState matchState) => item is NoSuchMethodError; | 490 bool matches(item, MatchState matchState) => item is NoSuchMethodError; |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 description.add(_featureDescription).add(' ').addDescriptionOf(_matcher); | 702 description.add(_featureDescription).add(' ').addDescriptionOf(_matcher); |
| 690 | 703 |
| 691 Description describeMismatch(item, Description mismatchDescription, | 704 Description describeMismatch(item, Description mismatchDescription, |
| 692 MatchState matchState, bool verbose) { | 705 MatchState matchState, bool verbose) { |
| 693 mismatchDescription.add(_featureName).add(' '); | 706 mismatchDescription.add(_featureName).add(' '); |
| 694 _matcher.describeMismatch(matchState.state['feature'], mismatchDescription, | 707 _matcher.describeMismatch(matchState.state['feature'], mismatchDescription, |
| 695 matchState.state['innerState'], verbose); | 708 matchState.state['innerState'], verbose); |
| 696 return mismatchDescription; | 709 return mismatchDescription; |
| 697 } | 710 } |
| 698 } | 711 } |
| OLD | NEW |