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

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

Issue 11417058: Revert "Remove NullPointerException." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 | « pkg/fixnum/test/int_64_test.dart ('k') | pkg/unittest/test/matchers_test.dart » ('j') | 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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
492 /** A matcher for UnsupportedError. */ 504 /** A matcher for UnsupportedError. */
493 const isUnsupportedError = const _UnsupportedError(); 505 const isUnsupportedError = const _UnsupportedError();
494 506
495 /** A matcher for functions that throw UnsupportedError. */ 507 /** A matcher for functions that throw UnsupportedError. */
496 const Matcher throwsUnsupportedError = const Throws(isUnsupportedError); 508 const Matcher throwsUnsupportedError = const Throws(isUnsupportedError);
497 509
498 class _UnsupportedError extends TypeMatcher { 510 class _UnsupportedError extends TypeMatcher {
499 const _UnsupportedError() : 511 const _UnsupportedError() :
500 super("UnsupportedError"); 512 super("UnsupportedError");
501 bool matches(item, MatchState matchState) => item is UnsupportedError; 513 bool matches(item, MatchState matchState) => item is UnsupportedError;
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 description.add(_featureDescription).add(' ').addDescriptionOf(_matcher); 689 description.add(_featureDescription).add(' ').addDescriptionOf(_matcher);
678 690
679 Description describeMismatch(item, Description mismatchDescription, 691 Description describeMismatch(item, Description mismatchDescription,
680 MatchState matchState, bool verbose) { 692 MatchState matchState, bool verbose) {
681 mismatchDescription.add(_featureName).add(' '); 693 mismatchDescription.add(_featureName).add(' ');
682 _matcher.describeMismatch(matchState.state['feature'], mismatchDescription, 694 _matcher.describeMismatch(matchState.state['feature'], mismatchDescription,
683 matchState.state['innerState'], verbose); 695 matchState.state['innerState'], verbose);
684 return mismatchDescription; 696 return mismatchDescription;
685 } 697 }
686 } 698 }
OLDNEW
« no previous file with comments | « pkg/fixnum/test/int_64_test.dart ('k') | pkg/unittest/test/matchers_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698