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

Unified Diff: lib/unittest/core_matchers.dart

Issue 10766006: Print the stack traces for Future expectations that raise exceptions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | lib/unittest/future_matchers.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/unittest/core_matchers.dart
diff --git a/lib/unittest/core_matchers.dart b/lib/unittest/core_matchers.dart
index c0b1d55040ff604edd2d8d3c01d10d88a646c205..d24518d4769c9f973cdc7ac3d624cafc17101f61 100644
--- a/lib/unittest/core_matchers.dart
+++ b/lib/unittest/core_matchers.dart
@@ -280,7 +280,13 @@ class _Throws extends BaseMatcher {
expect(false, reason:
"Expected future to fail, but succeeded with '${future.value}'.");
} else if (_matcher != null) {
- expect(future.exception, _matcher);
+ var reason;
+ if (future.stackTrace != null) {
+ var stackTrace = future.stackTrace.toString();
+ stackTrace = " ${stackTrace.replaceAll("\n", "\n ")}";
+ reason = "Actual exception trace:\n$stackTrace";
+ }
+ expect(future.exception, _matcher, reason: reason);
}
}));
« no previous file with comments | « no previous file | lib/unittest/future_matchers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698