Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Side by Side Diff: pkg/unittest/lib/src/core_matchers.dart

Issue 12077045: Add matches for StateErrors (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 497
498 /** A matcher for functions that throw UnsupportedError. */ 498 /** A matcher for functions that throw UnsupportedError. */
499 const Matcher throwsUnsupportedError = const Throws(isUnsupportedError); 499 const Matcher throwsUnsupportedError = const Throws(isUnsupportedError);
500 500
501 class _UnsupportedError extends TypeMatcher { 501 class _UnsupportedError extends TypeMatcher {
502 const _UnsupportedError() : 502 const _UnsupportedError() :
503 super("UnsupportedError"); 503 super("UnsupportedError");
504 bool matches(item, MatchState matchState) => item is UnsupportedError; 504 bool matches(item, MatchState matchState) => item is UnsupportedError;
505 } 505 }
506 506
507 /** A matcher for StateErrors. */
508 const isStateError = const _StateError();
509
510 /** A matcher for functions that throw StateError. */
511 const Matcher throwsStateError =
512 const Throws(isStateError);
513
514 class _StateError extends TypeMatcher {
515 const _StateError() : super("StateError");
516 bool matches(item, MatchState matchState) => item is StateError;
517 }
518
519
507 /** A matcher for Map types. */ 520 /** A matcher for Map types. */
508 const isMap = const _IsMap(); 521 const isMap = const _IsMap();
509 522
510 class _IsMap extends TypeMatcher { 523 class _IsMap extends TypeMatcher {
511 const _IsMap() : super("Map"); 524 const _IsMap() : super("Map");
512 bool matches(item, MatchState matchState) => item is Map; 525 bool matches(item, MatchState matchState) => item is Map;
513 } 526 }
514 527
515 /** A matcher for List types. */ 528 /** A matcher for List types. */
516 const isList = const _IsList(); 529 const isList = const _IsList();
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 description.add(_featureDescription).add(' ').addDescriptionOf(_matcher); 693 description.add(_featureDescription).add(' ').addDescriptionOf(_matcher);
681 694
682 Description describeMismatch(item, Description mismatchDescription, 695 Description describeMismatch(item, Description mismatchDescription,
683 MatchState matchState, bool verbose) { 696 MatchState matchState, bool verbose) {
684 mismatchDescription.add(_featureName).add(' '); 697 mismatchDescription.add(_featureName).add(' ');
685 _matcher.describeMismatch(matchState.state['feature'], mismatchDescription, 698 _matcher.describeMismatch(matchState.state['feature'], mismatchDescription,
686 matchState.state['innerState'], verbose); 699 matchState.state['innerState'], verbose);
687 return mismatchDescription; 700 return mismatchDescription;
688 } 701 }
689 } 702 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698