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

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

Issue 12335113: Unit test changes: (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/unittest/lib/src/config.dart ('k') | pkg/unittest/lib/src/interfaces.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/unittest/lib/src/expect.dart
===================================================================
--- pkg/unittest/lib/src/expect.dart (revision 19164)
+++ pkg/unittest/lib/src/expect.dart (working copy)
@@ -4,6 +4,18 @@
part of matcher;
+/** The objects thrown by the default failure handler. */
+class TestFailure {
+ String _message;
+
+ get message => _message;
+ set message(String value) => _message = value;
+
+ TestFailure(String message) : _message = message;
+
+ String toString() => _message;
+}
+
/**
* Some matchers, like those for Futures and exception testing,
* can fail in asynchronous sections, and throw exceptions.
@@ -24,8 +36,8 @@
* [matcher] can be a value in which case it will be wrapped in an
* [equals] matcher.
*
- * If the assertion fails, then the default behavior is to throw an
- * [ExpectException], but this behavior can be changed by calling
+ * If the assertion fails, then the default behavior is to throw a
+ * [TestFailure], but this behavior can be changed by calling
* [configureExpectFailureHandler] and providing an alternative handler that
* implements the [IFailureHandler] interface. It is also possible to
* pass a [failureHandler] to [expect] as a final parameter for fine-
@@ -75,7 +87,7 @@
// The handler for failed asserts.
FailureHandler _assertFailureHandler = null;
-// The default failure handler that throws ExpectExceptions.
+// The default failure handler that throws [TestFailure]s.
class DefaultFailureHandler implements FailureHandler {
DefaultFailureHandler() {
if (_assertErrorFormatter == null) {
@@ -83,7 +95,7 @@
}
}
void fail(String reason) {
- throw new ExpectException(reason);
+ throw new TestFailure(reason);
}
void failMatch(actual, Matcher matcher, String reason,
MatchState matchState, bool verbose) {
@@ -95,7 +107,7 @@
* Changes or resets to the default the failure handler for expect()
* [handler] is a reference to the new handler; if this is omitted
* or null then the failure handler is reset to the default, which
- * throws [ExpectExceptions] on [expect] assertion failures.
+ * throws [TestFailure]s on [expect] assertion failures.
*/
void configureExpectFailureHandler([FailureHandler handler = null]) {
if (handler == null) {
« no previous file with comments | « pkg/unittest/lib/src/config.dart ('k') | pkg/unittest/lib/src/interfaces.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698