| 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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 | 482 |
| 483 /** A matcher for functions that throw Exception. */ | 483 /** A matcher for functions that throw Exception. */ |
| 484 const Matcher throwsUnimplementedError = | 484 const Matcher throwsUnimplementedError = |
| 485 const Throws(isUnimplementedError); | 485 const Throws(isUnimplementedError); |
| 486 | 486 |
| 487 class _UnimplementedError extends TypeMatcher { | 487 class _UnimplementedError extends TypeMatcher { |
| 488 const _UnimplementedError() : super("UnimplementedError"); | 488 const _UnimplementedError() : super("UnimplementedError"); |
| 489 bool matches(item, MatchState matchState) => item is UnimplementedError; | 489 bool matches(item, MatchState matchState) => item is UnimplementedError; |
| 490 } | 490 } |
| 491 | 491 |
| 492 /** A matcher for NullPointerExceptions. */ | |
| 493 const isNullPointerException = const _NullPointerException(); | |
| 494 | |
| 495 /** A matcher for functions that throw NotNullPointerException. */ | |
| 496 const Matcher throwsNullPointerException = | |
| 497 const Throws(isNullPointerException); | |
| 498 | |
| 499 class _NullPointerException extends TypeMatcher { | |
| 500 const _NullPointerException() : super("NullPointerException"); | |
| 501 bool matches(item, MatchState matchState) => item is NullPointerException; | |
| 502 } | |
| 503 | |
| 504 /** A matcher for UnsupportedError. */ | 492 /** A matcher for UnsupportedError. */ |
| 505 const isUnsupportedError = const _UnsupportedError(); | 493 const isUnsupportedError = const _UnsupportedError(); |
| 506 | 494 |
| 507 /** A matcher for functions that throw UnsupportedError. */ | 495 /** A matcher for functions that throw UnsupportedError. */ |
| 508 const Matcher throwsUnsupportedError = const Throws(isUnsupportedError); | 496 const Matcher throwsUnsupportedError = const Throws(isUnsupportedError); |
| 509 | 497 |
| 510 class _UnsupportedError extends TypeMatcher { | 498 class _UnsupportedError extends TypeMatcher { |
| 511 const _UnsupportedError() : | 499 const _UnsupportedError() : |
| 512 super("UnsupportedError"); | 500 super("UnsupportedError"); |
| 513 bool matches(item, MatchState matchState) => item is UnsupportedError; | 501 bool matches(item, MatchState matchState) => item is UnsupportedError; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 description.add(_featureDescription).add(' ').addDescriptionOf(_matcher); | 677 description.add(_featureDescription).add(' ').addDescriptionOf(_matcher); |
| 690 | 678 |
| 691 Description describeMismatch(item, Description mismatchDescription, | 679 Description describeMismatch(item, Description mismatchDescription, |
| 692 MatchState matchState, bool verbose) { | 680 MatchState matchState, bool verbose) { |
| 693 mismatchDescription.add(_featureName).add(' '); | 681 mismatchDescription.add(_featureName).add(' '); |
| 694 _matcher.describeMismatch(matchState.state['feature'], mismatchDescription, | 682 _matcher.describeMismatch(matchState.state['feature'], mismatchDescription, |
| 695 matchState.state['innerState'], verbose); | 683 matchState.state['innerState'], verbose); |
| 696 return mismatchDescription; | 684 return mismatchDescription; |
| 697 } | 685 } |
| 698 } | 686 } |
| OLD | NEW |