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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 | 476 |
477 /** A matcher for functions that throw ArgumentError. */ | 477 /** A matcher for functions that throw ArgumentError. */ |
478 const Matcher throwsArgumentError = | 478 const Matcher throwsArgumentError = |
479 const Throws(isArgumentError); | 479 const Throws(isArgumentError); |
480 | 480 |
481 class _ArgumentError extends TypeMatcher { | 481 class _ArgumentError extends TypeMatcher { |
482 const _ArgumentError() : super("ArgumentError"); | 482 const _ArgumentError() : super("ArgumentError"); |
483 bool matches(item, MatchState matchState) => item is ArgumentError; | 483 bool matches(item, MatchState matchState) => item is ArgumentError; |
484 } | 484 } |
485 | 485 |
486 /** A matcher for IllegalJSRegExpExceptions. */ | |
487 const isIllegalJSRegExpException = const _IllegalJSRegExpException(); | |
488 | |
489 /** A matcher for functions that throw IllegalJSRegExpException. */ | |
490 @deprecated | |
491 const Matcher throwsIllegalJSRegExpException = | |
492 const Throws(isIllegalJSRegExpException); | |
493 | |
494 class _IllegalJSRegExpException extends TypeMatcher { | |
495 const _IllegalJSRegExpException() : super("IllegalJSRegExpException"); | |
496 bool matches(item, MatchState matchState) => item is IllegalJSRegExpException; | |
497 } | |
498 | |
499 /** A matcher for RangeErrors. */ | 486 /** A matcher for RangeErrors. */ |
500 const isRangeError = const _RangeError(); | 487 const isRangeError = const _RangeError(); |
501 | 488 |
502 /** A matcher for functions that throw RangeError. */ | 489 /** A matcher for functions that throw RangeError. */ |
503 const Matcher throwsRangeError = | 490 const Matcher throwsRangeError = |
504 const Throws(isRangeError); | 491 const Throws(isRangeError); |
505 | 492 |
506 class _RangeError extends TypeMatcher { | 493 class _RangeError extends TypeMatcher { |
507 const _RangeError() : super("RangeError"); | 494 const _RangeError() : super("RangeError"); |
508 bool matches(item, MatchState matchState) => item is RangeError; | 495 bool matches(item, MatchState matchState) => item is RangeError; |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 description.add(_featureDescription).add(' ').addDescriptionOf(_matcher); | 723 description.add(_featureDescription).add(' ').addDescriptionOf(_matcher); |
737 | 724 |
738 Description describeMismatch(item, Description mismatchDescription, | 725 Description describeMismatch(item, Description mismatchDescription, |
739 MatchState matchState, bool verbose) { | 726 MatchState matchState, bool verbose) { |
740 mismatchDescription.add(_featureName).add(' '); | 727 mismatchDescription.add(_featureName).add(' '); |
741 _matcher.describeMismatch(matchState.state['feature'], mismatchDescription, | 728 _matcher.describeMismatch(matchState.state['feature'], mismatchDescription, |
742 matchState.state['innerState'], verbose); | 729 matchState.state['innerState'], verbose); |
743 return mismatchDescription; | 730 return mismatchDescription; |
744 } | 731 } |
745 } | 732 } |
OLD | NEW |