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

Side by Side Diff: tests/lib/async/future_delayed_error_test.dart

Issue 14070010: Refactor Future constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added co19 issue number. Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/lib/async/future_constructor_test.dart ('k') | tests/lib/async/future_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library future_delayed_error_test; 5 library future_delayed_error_test;
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:isolate'; 9 import 'dart:isolate';
10 10
11 testImmediateError() { 11 testImmediateError() {
12 // An open ReceivePort keeps the VM running. If the error-handler below is not 12 // An open ReceivePort keeps the VM running. If the error-handler below is not
13 // executed then the test will fail with a timeout. 13 // executed then the test will fail with a timeout.
14 var port = new ReceivePort(); 14 var port = new ReceivePort();
15 var future = new Future.immediateError("error"); 15 var future = new Future.error("error");
16 future.catchError((error) { 16 future.catchError((error) {
17 port.close(); 17 port.close();
18 Expect.equals(error, "error"); 18 Expect.equals(error, "error");
19 }); 19 });
20 } 20 }
21 21
22 Future get completedFuture { 22 Future get completedFuture {
23 var completer = new Completer(); 23 var completer = new Completer();
24 completer.completeError("foobar"); 24 completer.completeError("foobar");
25 return completer.future; 25 return completer.future;
26 } 26 }
27 27
28 testDelayedError() { 28 testDelayedError() {
29 var port = new ReceivePort(); 29 var port = new ReceivePort();
30 completedFuture.catchError((error) { 30 completedFuture.catchError((error) {
31 port.close(); 31 port.close();
32 Expect.equals(error, "foobar"); 32 Expect.equals(error, "foobar");
33 }); 33 });
34 } 34 }
35 35
36 main() { 36 main() {
37 testImmediateError(); 37 testImmediateError();
38 testDelayedError(); 38 testDelayedError();
39 } 39 }
40 40
OLDNEW
« no previous file with comments | « tests/lib/async/future_constructor_test.dart ('k') | tests/lib/async/future_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698