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

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

Issue 11783009: Big merge from experimental to bleeding edge. (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 | « pkg/unittest/lib/src/core_matchers.dart ('k') | pkg/unittest/lib/unittest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/unittest/lib/src/future_matchers.dart
diff --git a/pkg/unittest/lib/src/future_matchers.dart b/pkg/unittest/lib/src/future_matchers.dart
index ce7e804340228e62ebfa701d04d7746fa6ed36fe..9154c7c1b72f9abb223a0cbbcbf5ff1613d9df40 100644
--- a/pkg/unittest/lib/src/future_matchers.dart
+++ b/pkg/unittest/lib/src/future_matchers.dart
@@ -35,18 +35,20 @@ class _Completes extends BaseMatcher {
bool matches(item, MatchState matchState) {
if (item is! Future) return false;
- item.onComplete(wrapAsync((future) {
+ item.then((value) {
+ if (_matcher != null) expect(value, _matcher);
+ });
+
+ item.catchError((e) {
var reason = 'Expected future to complete successfully, but it failed '
- 'with ${future.exception}';
+ 'with ${e.error}';
if (future.stackTrace != null) {
- var stackTrace = future.stackTrace.toString();
+ var stackTrace = e.stackTrace.toString();
stackTrace = ' ${stackTrace.replaceAll('\n', '\n ')}';
reason = '$reason\nStack trace:\n$stackTrace';
}
-
- expect(future.hasValue, isTrue, reason: reason);
- if (_matcher != null) expect(future.value, _matcher);
- }));
+ expect(false, isTrue, reason: reason);
+ });
return true;
}
« no previous file with comments | « pkg/unittest/lib/src/core_matchers.dart ('k') | pkg/unittest/lib/unittest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698