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

Unified Diff: pkg/unittest/core_matchers.dart

Issue 10987041: Make the matcher classes for exceptions public so that users can use them to create matchers for th… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/unittest/core_matchers.dart
===================================================================
--- pkg/unittest/core_matchers.dart (revision 12884)
+++ pkg/unittest/core_matchers.dart (working copy)
@@ -238,7 +238,7 @@
* return immediately and execution will continue. Later, when the future
* completes, the actual expectation will run.
*/
-const Matcher throws = const _Throws();
+const Matcher throws = const Throws();
/**
* This can be used to match two kinds of objects:
@@ -268,10 +268,10 @@
*/
const Matcher returnsNormally = const _ReturnsNormally();
-class _Throws extends BaseMatcher {
+class Throws extends BaseMatcher {
final Matcher _matcher;
- const _Throws([Matcher matcher]) :
+ const Throws([Matcher matcher]) :
this._matcher = matcher;
bool matches(item, MatchState matchState) {
@@ -393,9 +393,9 @@
* for each exception type.
*/
-/* abstract */ class _ExceptionMatcher extends BaseMatcher {
+/* abstract */ class ExceptionMatcher extends BaseMatcher {
final String _name;
- const _ExceptionMatcher(this._name);
+ const ExceptionMatcher(this._name);
Description describe(Description description) =>
description.add(_name);
}
@@ -405,9 +405,9 @@
/** A matcher for functions that throw FormatException */
const Matcher throwsFormatException =
- const _Throws(isFormatException);
+ const Throws(isFormatException);
-class _FormatException extends _ExceptionMatcher {
+class _FormatException extends ExceptionMatcher {
const _FormatException() : super("FormatException");
bool matches(item, MatchState matchState) => item is FormatException;
}
@@ -416,9 +416,9 @@
const isException = const _Exception();
/** A matcher for functions that throw Exception */
-const Matcher throwsException = const _Throws(isException);
+const Matcher throwsException = const Throws(isException);
-class _Exception extends _ExceptionMatcher {
+class _Exception extends ExceptionMatcher {
const _Exception() : super("Exception");
bool matches(item, MatchState matchState) => item is Exception;
}
@@ -428,9 +428,9 @@
/** A matcher for functions that throw ArgumentError */
const Matcher throwsArgumentError =
- const _Throws(isArgumentError);
+ const Throws(isArgumentError);
-class _ArgumentError extends _ExceptionMatcher {
+class _ArgumentError extends ExceptionMatcher {
const _ArgumentError() : super("ArgumentError");
bool matches(item, MatchState matchState) => item is ArgumentError;
}
@@ -440,9 +440,9 @@
/** A matcher for functions that throw IllegalJSRegExpException */
const Matcher throwsIllegalJSRegExpException =
- const _Throws(isIllegalJSRegExpException);
+ const Throws(isIllegalJSRegExpException);
-class _IllegalJSRegExpException extends _ExceptionMatcher {
+class _IllegalJSRegExpException extends ExceptionMatcher {
const _IllegalJSRegExpException() : super("IllegalJSRegExpException");
bool matches(item, MatchState matchState) => item is IllegalJSRegExpException;
}
@@ -452,9 +452,9 @@
/** A matcher for functions that throw IndexOutOfRangeException */
const Matcher throwsIndexOutOfRangeException =
- const _Throws(isIndexOutOfRangeException);
+ const Throws(isIndexOutOfRangeException);
-class _IndexOutOfRangeException extends _ExceptionMatcher {
+class _IndexOutOfRangeException extends ExceptionMatcher {
const _IndexOutOfRangeException() : super("IndexOutOfRangeException");
bool matches(item, MatchState matchState) => item is IndexOutOfRangeException;
}
@@ -464,9 +464,9 @@
/** A matcher for functions that throw NoSuchMethodError */
const Matcher throwsNoSuchMethodError =
- const _Throws(isNoSuchMethodError);
+ const Throws(isNoSuchMethodError);
-class _NoSuchMethodError extends _ExceptionMatcher {
+class _NoSuchMethodError extends ExceptionMatcher {
const _NoSuchMethodError() : super("NoSuchMethodError");
bool matches(item, MatchState matchState) => item is NoSuchMethodError;
}
@@ -476,9 +476,9 @@
/** A matcher for functions that throw Exception */
const Matcher throwsNotImplementedException =
- const _Throws(isNotImplementedException);
+ const Throws(isNotImplementedException);
-class _NotImplementedException extends _ExceptionMatcher {
+class _NotImplementedException extends ExceptionMatcher {
const _NotImplementedException() : super("NotImplementedException");
bool matches(item, MatchState matchState) => item is NotImplementedException;
}
@@ -488,9 +488,9 @@
/** A matcher for functions that throw NotNullPointerException */
const Matcher throwsNullPointerException =
- const _Throws(isNullPointerException);
+ const Throws(isNullPointerException);
-class _NullPointerException extends _ExceptionMatcher {
+class _NullPointerException extends ExceptionMatcher {
const _NullPointerException() : super("NullPointerException");
bool matches(item, MatchState matchState) => item is NullPointerException;
}
@@ -500,12 +500,13 @@
/** A matcher for functions that throw UnsupportedOperationException */
const Matcher throwsUnsupportedOperationException =
- const _Throws(isUnsupportedOperationException);
+ const Throws(isUnsupportedOperationException);
-class _UnsupportedOperationException extends _ExceptionMatcher {
+class _UnsupportedOperationException extends ExceptionMatcher {
const _UnsupportedOperationException() :
super("UnsupportedOperationException");
- bool matches(item, MatchState matchState) => item is UnsupportedOperationException;
+ bool matches(item, MatchState matchState) =>
+ item is UnsupportedOperationException;
}
/**
« 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