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

Unified Diff: pkg/unittest/test/matchers_unminified_test.dart

Issue 16408019: Improved error messages from unittest. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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
Index: pkg/unittest/test/matchers_unminified_test.dart
===================================================================
--- pkg/unittest/test/matchers_unminified_test.dart (revision 24002)
+++ pkg/unittest/test/matchers_unminified_test.dart (working copy)
@@ -22,9 +22,10 @@
shouldFail(() { throw new Exception(); },
throwsFormatException,
matches(
- r"Expected: throws an exception which matches FormatException +"
- r"But: exception \?:<Exception> does not match FormatException\."
- r"Actual: <Closure(: \(dynamic\) => dynamic)?>"));
+ r"Expected: throws FormatException +"
+ r"Actual: <Closure(: \(dynamic\) => dynamic)?> +"
+ r"Which: threw \?:<Exception>"));
+
});
test('throwsArgumentError', () {
@@ -33,10 +34,9 @@
shouldFail(() { throw new Exception(); },
throwsArgumentError,
matches(
- r"Expected: throws an exception which matches ArgumentError +"
- r"But: exception \?:<Exception> does not match "
- r"ArgumentError\."
- r"Actual: <Closure(: \(dynamic\) => dynamic)?>"));
+ r"Expected: throws ArgumentError +"
+ r"Actual: <Closure(: \(dynamic\) => dynamic)?> +"
+ r"Which: threw \?:<Exception>"));
});
test('throwsRangeError', () {
@@ -45,9 +45,9 @@
shouldFail(() { throw new Exception(); },
throwsRangeError,
matches(
- r"Expected: throws an exception which matches RangeError +"
- r"But: exception \?:<Exception> does not match RangeError\."
- r"Actual: <Closure(: \(dynamic\) => dynamic)?>"));
+ r"Expected: throws RangeError +"
+ r"Actual: <Closure(: \(dynamic\) => dynamic)?> +"
+ r"Which: threw \?:<Exception>"));
});
test('throwsNoSuchMethodError', () {
@@ -56,10 +56,9 @@
shouldFail(() { throw new Exception(); },
throwsNoSuchMethodError,
matches(
- r"Expected: throws an exception which matches NoSuchMethodError +"
- r"But: exception \?:<Exception> does not match "
- r"NoSuchMethodError\."
- r"Actual: <Closure(: \(dynamic\) => dynamic)?>"));
+ r"Expected: throws NoSuchMethodError +"
+ r"Actual: <Closure(: \(dynamic\) => dynamic)?> +"
+ r"Which: threw \?:<Exception>"));
});
test('throwsUnimplementedError', () {
@@ -68,11 +67,9 @@
shouldFail(() { throw new Exception(); },
throwsUnimplementedError,
matches(
- r"Expected: throws an exception which matches "
- r"UnimplementedError +"
- r"But: exception \?:<Exception> does not match "
- r"UnimplementedError\."
- r"Actual: <Closure(: \(dynamic\) => dynamic)?>"));
+ r"Expected: throws UnimplementedError +"
+ r"Actual: <Closure(: \(dynamic\) => dynamic)?> +"
+ r"Which: threw \?:<Exception>"));
});
test('throwsUnsupportedError', () {
@@ -81,10 +78,9 @@
shouldFail(() { throw new Exception(); },
throwsUnsupportedError,
matches(
- r"Expected: throws an exception which matches UnsupportedError +"
- r"But: exception \?:<Exception> does not match "
- r"UnsupportedError\."
- r"Actual: <Closure(: \(dynamic\) => dynamic)?>"));
+ r"Expected: throws UnsupportedError +"
+ r"Actual: <Closure(: \(dynamic\) => dynamic)?> +"
+ r"Which: threw \?:<Exception>"));
});
test('throwsStateError', () {
@@ -93,10 +89,9 @@
shouldFail(() { throw new Exception(); },
throwsStateError,
matches(
- r"Expected: throws an exception which matches StateError +"
- r"But: exception \?:<Exception> does not match "
- r"StateError\."
- r"Actual: <Closure(: \(dynamic\) => dynamic)?>"));
+ r"Expected: throws StateError +"
+ r"Actual: <Closure(: \(dynamic\) => dynamic)?> +"
+ r"Which: threw \?:<Exception>"));
});
});
@@ -106,7 +101,6 @@
var e = new SimpleIterable(1);
shouldPass(d, isEmpty);
shouldFail(e, isEmpty, "Expected: empty "
- "But: was SimpleIterable:[1]. "
"Actual: SimpleIterable:[1]");
});
@@ -115,7 +109,6 @@
shouldPass(d, contains(2));
shouldFail(d, contains(5),
"Expected: contains <5> "
- "But: was SimpleIterable:[3, 2, 1]. "
"Actual: SimpleIterable:[3, 2, 1]");
});
});
@@ -128,8 +121,9 @@
shouldPass(w, new HasPrice(greaterThan(0)));
shouldFail(w, new HasPrice(greaterThan(10)),
"Expected: Widget with a price that is a value greater than <10> "
- "But: price was <10>. "
- "Actual: <Instance of 'Widget'>");
+ "Actual: <Instance of 'Widget'> "
+ "Which: has price with value <10> which is not "
+ "a value greater than <10>");
});
});
}

Powered by Google App Engine
This is Rietveld 408576698