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

Unified Diff: tests/lib/async/future_delayed_error_test.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 | « tests/lib/async/event_helper.dart ('k') | tests/lib/async/future_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/async/future_delayed_error_test.dart
diff --git a/tests/lib/async/future_delayed_error_test.dart b/tests/lib/async/future_delayed_error_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..a3fea32a5694c2ae41c04418022ec349be44beac
--- /dev/null
+++ b/tests/lib/async/future_delayed_error_test.dart
@@ -0,0 +1,37 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+import 'dart:isolate';
+
+testImmediateError() {
+ // An open ReceivePort keeps the VM running. If the error-handler below is not
+ // executed then the test will fail with a timeout.
+ var port = new ReceivePort();
+ var future = new Future.immediateError("error");
+ future.catchError((e) {
+ port.close();
+ Expect.equals(e.error, "error");
+ });
+}
+
+Future get completedFuture {
+ var completer = new Completer();
+ completer.completeError("foobar");
+ return completer.future;
+}
+
+testDelayedError() {
+ var port = new ReceivePort();
+ completedFuture.catchError((e) {
+ port.close();
+ Expect.equals(e.error, "foobar");
+ });
+}
+
+main() {
+ testImmediateError();
+ testDelayedError();
+}
+
« no previous file with comments | « tests/lib/async/event_helper.dart ('k') | tests/lib/async/future_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698