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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 | 483 |
484 /** A matcher for functions that throw NoSuchMethodError. */ | 484 /** A matcher for functions that throw NoSuchMethodError. */ |
485 const Matcher throwsNoSuchMethodError = | 485 const Matcher throwsNoSuchMethodError = |
486 const Throws(isNoSuchMethodError); | 486 const Throws(isNoSuchMethodError); |
487 | 487 |
488 class _NoSuchMethodError extends TypeMatcher { | 488 class _NoSuchMethodError extends TypeMatcher { |
489 const _NoSuchMethodError() : super("NoSuchMethodError"); | 489 const _NoSuchMethodError() : super("NoSuchMethodError"); |
490 bool matches(item, MatchState matchState) => item is NoSuchMethodError; | 490 bool matches(item, MatchState matchState) => item is NoSuchMethodError; |
491 } | 491 } |
492 | 492 |
| 493 /** A matcher for UnimplementedErrors. */ |
| 494 const isUnimplementedError = const _UnimplementedError(); |
| 495 |
| 496 /** A matcher for functions that throw Exception. */ |
| 497 const Matcher throwsUnimplementedError = |
| 498 const Throws(isUnimplementedError); |
| 499 |
| 500 class _UnimplementedError extends TypeMatcher { |
| 501 const _UnimplementedError() : super("UnimplementedError"); |
| 502 bool matches(item, MatchState matchState) => item is UnimplementedError; |
| 503 } |
| 504 |
| 505 // Temporary matcher until NotImplementedException is removed. |
493 /** A matcher for NotImplementedExceptions. */ | 506 /** A matcher for NotImplementedExceptions. */ |
494 const isNotImplementedException = const _NotImplementedException(); | 507 const isNotImplementedException = isUnimplementedError; |
495 | 508 |
496 /** A matcher for functions that throw Exception. */ | 509 /** A matcher for functions that throw Exception. */ |
497 const Matcher throwsNotImplementedException = | 510 const Matcher throwsNotImplementedException = |
498 const Throws(isNotImplementedException); | 511 const Throws(isUnimplementedError); |
499 | 512 |
500 class _NotImplementedException extends TypeMatcher { | |
501 const _NotImplementedException() : super("NotImplementedException"); | |
502 bool matches(item, MatchState matchState) => item is NotImplementedException; | |
503 } | |
504 | 513 |
505 /** A matcher for NullPointerExceptions. */ | 514 /** A matcher for NullPointerExceptions. */ |
506 const isNullPointerException = const _NullPointerException(); | 515 const isNullPointerException = const _NullPointerException(); |
507 | 516 |
508 /** A matcher for functions that throw NotNullPointerException. */ | 517 /** A matcher for functions that throw NotNullPointerException. */ |
509 const Matcher throwsNullPointerException = | 518 const Matcher throwsNullPointerException = |
510 const Throws(isNullPointerException); | 519 const Throws(isNullPointerException); |
511 | 520 |
512 class _NullPointerException extends TypeMatcher { | 521 class _NullPointerException extends TypeMatcher { |
513 const _NullPointerException() : super("NullPointerException"); | 522 const _NullPointerException() : super("NullPointerException"); |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 description.add(_featureDescription).add(' ').addDescriptionOf(_matcher); | 711 description.add(_featureDescription).add(' ').addDescriptionOf(_matcher); |
703 | 712 |
704 Description describeMismatch(item, Description mismatchDescription, | 713 Description describeMismatch(item, Description mismatchDescription, |
705 MatchState matchState, bool verbose) { | 714 MatchState matchState, bool verbose) { |
706 mismatchDescription.add(_featureName).add(' '); | 715 mismatchDescription.add(_featureName).add(' '); |
707 _matcher.describeMismatch(matchState.state['feature'], mismatchDescription, | 716 _matcher.describeMismatch(matchState.state['feature'], mismatchDescription, |
708 matchState.state['innerState'], verbose); | 717 matchState.state['innerState'], verbose); |
709 return mismatchDescription; | 718 return mismatchDescription; |
710 } | 719 } |
711 } | 720 } |
OLD | NEW |