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

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

Issue 2252823004: Deal with synchronous errors in Future.wait. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments. Created 4 years, 4 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 | « sdk/lib/async/future.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/async/future_test.dart
diff --git a/tests/lib/async/future_test.dart b/tests/lib/async/future_test.dart
index 52185f2ae8044981b6624bb2b8f9a4ecf246b3c5..71c509b6fd3973e7790df4418d8b1e55dd7bcb72 100644
--- a/tests/lib/async/future_test.dart
+++ b/tests/lib/async/future_test.dart
@@ -876,6 +876,26 @@ void testWaitCleanUpError() {
});
}
+void testWaitSyncError() {
+ var cms = const Duration(milliseconds: 100);
+ var cleanups = new List.filled(3, false);
+ var uncaughts = new List.filled(3, false);
+ asyncStart();
+ asyncStart();
+ runZoned(() {
+ Future.wait(new Iterable.generate(5, (i) {
+ if (i != 3) return new Future.delayed(cms * (i + 1), () => i);
+ throw "throwing synchronously in iterable";
+ }), cleanUp: (index) {
+ Expect.isFalse(cleanups[index]);
+ cleanups[index] = true;
+ if (cleanups.every((x) => x)) asyncEnd();
+ });
+ }, onError: (e, s) {
+ asyncEnd();
+ });
+}
+
void testBadFuture() {
var bad = new BadFuture();
// Completing with bad future (then call throws) puts error in result.
@@ -1075,6 +1095,7 @@ main() {
testWaitCleanUp();
testWaitCleanUpError();
+ testWaitSyncError();
testBadFuture();
« no previous file with comments | « sdk/lib/async/future.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698