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

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

Issue 11821039: More fixes to unittest (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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/lib/src/future_matchers.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 a9053a375cf3a18eeb35e0181d967d24a31af2d3..fbf146560db8ed7fdd1a30a5b2ff3d8ec0b602ca 100644
--- a/pkg/unittest/lib/src/core_matchers.dart
+++ b/pkg/unittest/lib/src/core_matchers.dart
@@ -290,13 +290,16 @@ class Throws extends BaseMatcher {
done(() => expect(false, isTrue, reason:
"Expected future to fail, but succeeded with '$value'."));
}, onError: (e) {
- var reason;
- if (e.stackTrace != null) {
- var stackTrace = e.stackTrace.toString();
- stackTrace = " ${stackTrace.replaceAll("\n", "\n ")}";
- reason = "Actual exception trace:\n$stackTrace";
- }
- done(() => expect(e.error, _matcher, reason: reason));
+ done(() {
+ if (_matcher == null) return;
+ var reason;
+ if (e.stackTrace != null) {
+ var stackTrace = e.stackTrace.toString();
+ stackTrace = " ${stackTrace.replaceAll("\n", "\n ")}";
+ reason = "Actual exception trace:\n$stackTrace";
+ }
+ expect(e.error, _matcher, reason: reason);
+ });
});
// It hasn't failed yet.
« no previous file with comments | « no previous file | pkg/unittest/lib/src/future_matchers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698