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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/unittest/lib/src/core_matchers.dart
diff --git a/pkg/unittest/lib/src/core_matchers.dart b/pkg/unittest/lib/src/core_matchers.dart
index 3846fdd1810a292690a5b24e0074d09cc871a77d..20e9db2efbb2628e8a9bb4a0f55ad0961d2fadc0 100644
--- a/pkg/unittest/lib/src/core_matchers.dart
+++ b/pkg/unittest/lib/src/core_matchers.dart
@@ -489,6 +489,18 @@ class _UnimplementedError extends TypeMatcher {
bool matches(item, MatchState matchState) => item is UnimplementedError;
}
+/** A matcher for NullPointerExceptions. */
+const isNullPointerException = const _NullPointerException();
+
+/** A matcher for functions that throw NotNullPointerException. */
+const Matcher throwsNullPointerException =
+ const Throws(isNullPointerException);
+
+class _NullPointerException extends TypeMatcher {
+ const _NullPointerException() : super("NullPointerException");
+ bool matches(item, MatchState matchState) => item is NullPointerException;
+}
+
/** A matcher for UnsupportedError. */
const isUnsupportedError = const _UnsupportedError();
« 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