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 const Matcher throwsIllegalJSRegExpException = | |
491 const Throws(isIllegalJSRegExpException); | |
492 | |
493 class _IllegalJSRegExpException extends TypeMatcher { | |
494 const _IllegalJSRegExpException() : super("IllegalJSRegExpException"); | |
495 bool matches(item, MatchState matchState) => item is IllegalJSRegExpException; | |
496 } | |
497 | |
498 /** A matcher for RangeErrors. */ | 486 /** A matcher for RangeErrors. */ |
499 const isRangeError = const _RangeError(); | 487 const isRangeError = const _RangeError(); |
500 | 488 |
501 /** A matcher for functions that throw RangeError. */ | 489 /** A matcher for functions that throw RangeError. */ |
502 const Matcher throwsRangeError = | 490 const Matcher throwsRangeError = |
503 const Throws(isRangeError); | 491 const Throws(isRangeError); |
504 | 492 |
505 class _RangeError extends TypeMatcher { | 493 class _RangeError extends TypeMatcher { |
506 const _RangeError() : super("RangeError"); | 494 const _RangeError() : super("RangeError"); |
507 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... |
735 description.add(_featureDescription).add(' ').addDescriptionOf(_matcher); | 723 description.add(_featureDescription).add(' ').addDescriptionOf(_matcher); |
736 | 724 |
737 Description describeMismatch(item, Description mismatchDescription, | 725 Description describeMismatch(item, Description mismatchDescription, |
738 MatchState matchState, bool verbose) { | 726 MatchState matchState, bool verbose) { |
739 mismatchDescription.add(_featureName).add(' '); | 727 mismatchDescription.add(_featureName).add(' '); |
740 _matcher.describeMismatch(matchState.state['feature'], mismatchDescription, | 728 _matcher.describeMismatch(matchState.state['feature'], mismatchDescription, |
741 matchState.state['innerState'], verbose); | 729 matchState.state['innerState'], verbose); |
742 return mismatchDescription; | 730 return mismatchDescription; |
743 } | 731 } |
744 } | 732 } |
OLD | NEW |