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 unittest; | 5 part of unittest; |
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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 | 446 |
447 /** A matcher for functions that throw IllegalJSRegExpException. */ | 447 /** A matcher for functions that throw IllegalJSRegExpException. */ |
448 const Matcher throwsIllegalJSRegExpException = | 448 const Matcher throwsIllegalJSRegExpException = |
449 const Throws(isIllegalJSRegExpException); | 449 const Throws(isIllegalJSRegExpException); |
450 | 450 |
451 class _IllegalJSRegExpException extends TypeMatcher { | 451 class _IllegalJSRegExpException extends TypeMatcher { |
452 const _IllegalJSRegExpException() : super("IllegalJSRegExpException"); | 452 const _IllegalJSRegExpException() : super("IllegalJSRegExpException"); |
453 bool matches(item, MatchState matchState) => item is IllegalJSRegExpException; | 453 bool matches(item, MatchState matchState) => item is IllegalJSRegExpException; |
454 } | 454 } |
455 | 455 |
456 /** A matcher for IndexOutOfRangeExceptions. */ | 456 /** A matcher for RangeErrors. */ |
457 const isIndexOutOfRangeException = const _IndexOutOfRangeException(); | 457 const isRangeError = const _RangeError(); |
458 | 458 |
459 /** A matcher for functions that throw IndexOutOfRangeException. */ | 459 /** A matcher for functions that throw RangeError */ |
460 const Matcher throwsIndexOutOfRangeException = | 460 const Matcher throwsRangeError = |
461 const Throws(isIndexOutOfRangeException); | 461 const Throws(isRangeError); |
462 | 462 |
463 class _IndexOutOfRangeException extends TypeMatcher { | 463 class _RangeError extends TypeMatcher { |
464 const _IndexOutOfRangeException() : super("IndexOutOfRangeException"); | 464 const _RangeError() : super("RangeError"); |
465 bool matches(item, MatchState matchState) => item is IndexOutOfRangeException; | 465 bool matches(item, MatchState matchState) => item is RangeError; |
466 } | 466 } |
467 | 467 |
468 /** A matcher for NoSuchMethodErrors. */ | 468 /** A matcher for NoSuchMethodErrors. */ |
469 const isNoSuchMethodError = const _NoSuchMethodError(); | 469 const isNoSuchMethodError = const _NoSuchMethodError(); |
470 | 470 |
471 /** A matcher for functions that throw NoSuchMethodError. */ | 471 /** A matcher for functions that throw NoSuchMethodError. */ |
472 const Matcher throwsNoSuchMethodError = | 472 const Matcher throwsNoSuchMethodError = |
473 const Throws(isNoSuchMethodError); | 473 const Throws(isNoSuchMethodError); |
474 | 474 |
475 class _NoSuchMethodError extends TypeMatcher { | 475 class _NoSuchMethodError extends TypeMatcher { |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 description.add(_featureDescription).add(' ').addDescriptionOf(_matcher); | 689 description.add(_featureDescription).add(' ').addDescriptionOf(_matcher); |
690 | 690 |
691 Description describeMismatch(item, Description mismatchDescription, | 691 Description describeMismatch(item, Description mismatchDescription, |
692 MatchState matchState, bool verbose) { | 692 MatchState matchState, bool verbose) { |
693 mismatchDescription.add(_featureName).add(' '); | 693 mismatchDescription.add(_featureName).add(' '); |
694 _matcher.describeMismatch(matchState.state['feature'], mismatchDescription, | 694 _matcher.describeMismatch(matchState.state['feature'], mismatchDescription, |
695 matchState.state['innerState'], verbose); | 695 matchState.state['innerState'], verbose); |
696 return mismatchDescription; | 696 return mismatchDescription; |
697 } | 697 } |
698 } | 698 } |
OLD | NEW |