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

Unified Diff: tests/lib/async/future_value_chain3_test.dart

Issue 23926011: Rewrite Futures. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove chained future cycle test. Created 7 years, 3 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: tests/lib/async/future_value_chain3_test.dart
diff --git a/tests/lib/async/catch_errors_test.dart b/tests/lib/async/future_value_chain3_test.dart
similarity index 50%
copy from tests/lib/async/catch_errors_test.dart
copy to tests/lib/async/future_value_chain3_test.dart
index f4e0eef4ad4edd8ea78700c3cd684d0188495bc1..d6d9abfb1c84e5ac29589b68ab2215e39e28befe 100644
--- a/tests/lib/async/catch_errors_test.dart
+++ b/tests/lib/async/future_value_chain3_test.dart
@@ -5,18 +5,19 @@
import 'package:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'catch_errors.dart';
+
main() {
asyncStart();
- // Make sure `catchErrors` shuts down the error stream when the synchronous
- // operation is done and there isn't any asynchronous pending callback.
- catchErrors(() {
- return 'allDone';
- }).listen((x) {
- Expect.fail("Unexpected callback");
- },
- onDone: () {
+ var errorFuture = new Future.error(499);
+ errorFuture.catchError((x) {
+ Expect.equals(499, x);
+ var valueChainFuture = new Future.sync(() => errorFuture);
+ // The errorFuture must not be propagated immediately as we would otherwise
+ // not have time to catch the error.
+ valueChainFuture.catchError((error) {
+ Expect.equals(499, error);
asyncEnd();
});
+ });
}

Powered by Google App Engine
This is Rietveld 408576698