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

Unified Diff: pkg/unittest/lib/src/core_matchers.dart

Issue 20586002: Add matchers for some more recent error types. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | 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
===================================================================
--- pkg/unittest/lib/src/core_matchers.dart (revision 25478)
+++ pkg/unittest/lib/src/core_matchers.dart (working copy)
@@ -616,7 +616,68 @@
bool matches(item, Map matchState) => item is StateError;
}
+/** A matcher for FallThroughError. */
+const isFallThroughError = const _FallThroughError();
+/** A matcher for functions that throw FallThroughError. */
+const Matcher throwsFallThroughError =
+ const Throws(isFallThroughError);
+
+class _FallThroughError extends TypeMatcher {
+ const _FallThroughError() : super("FallThroughError");
+ bool matches(item, Map matchState) => item is FallThroughError;
+}
+
+/** A matcher for NullThrownError. */
+const isNullThrownError = const _NullThrownError();
+
+/** A matcher for functions that throw NullThrownError. */
+const Matcher throwsNullThrownError =
+ const Throws(isNullThrownError);
+
+class _NullThrownError extends TypeMatcher {
+ const _NullThrownError() : super("NullThrownError");
+ bool matches(item, Map matchState) => item is NullThrownError;
+}
+
+/** A matcher for ConcurrentModificationError. */
+const isConcurrentModificationError = const _ConcurrentModificationError();
+
+/** A matcher for functions that throw ConcurrentModificationError. */
+const Matcher throwsConcurrentModificationError =
+ const Throws(isConcurrentModificationError);
+
+class _ConcurrentModificationError extends TypeMatcher {
+ const _ConcurrentModificationError() : super("ConcurrentModificationError");
+ bool matches(item, Map matchState) => item is ConcurrentModificationError;
+}
+
+/** A matcher for AbstractClassInstantiationError. */
+const isAbstractClassInstantiationError =
+ const _AbstractClassInstantiationError();
+
+/** A matcher for functions that throw AbstractClassInstantiationError. */
+const Matcher throwsAbstractClassInstantiationError =
+ const Throws(isAbstractClassInstantiationError);
+
+class _AbstractClassInstantiationError extends TypeMatcher {
+ const _AbstractClassInstantiationError() :
+ super("AbstractClassInstantiationError");
+ bool matches(item, Map matchState) => item is AbstractClassInstantiationError;
+}
+
+/** A matcher for CyclicInitializationError. */
+const isCyclicInitializationError = const _CyclicInitializationError();
+
+/** A matcher for functions that throw CyclicInitializationError. */
+const Matcher throwsCyclicInitializationError =
+ const Throws(isCyclicInitializationError);
+
+class _CyclicInitializationError extends TypeMatcher {
+ const _CyclicInitializationError() : super("CyclicInitializationError");
+ bool matches(item, Map matchState) => item is CyclicInitializationError;
+}
+
/** A matcher for Map types. */
const isMap = const _IsMap();
« no previous file with comments | « no previous file | pkg/unittest/test/matchers_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698