OLD | NEW |
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"; | |
8 import 'dart:async'; | 7 import 'dart:async'; |
9 import 'dart:isolate'; | 8 import 'dart:isolate'; |
10 | 9 |
11 testImmediateError() { | 10 testImmediateError() { |
12 // An open ReceivePort keeps the VM running. If the error-handler below is not | 11 // An open ReceivePort keeps the VM running. If the error-handler below is not |
13 // executed then the test will fail with a timeout. | 12 // executed then the test will fail with a timeout. |
14 var port = new ReceivePort(); | 13 var port = new ReceivePort(); |
15 var future = new Future.immediateError("error"); | 14 var future = new Future.immediateError("error"); |
16 future.catchError((e) { | 15 future.catchError((e) { |
17 port.close(); | 16 port.close(); |
(...skipping 13 matching lines...) Expand all Loading... |
31 port.close(); | 30 port.close(); |
32 Expect.equals(e.error, "foobar"); | 31 Expect.equals(e.error, "foobar"); |
33 }); | 32 }); |
34 } | 33 } |
35 | 34 |
36 main() { | 35 main() { |
37 testImmediateError(); | 36 testImmediateError(); |
38 testDelayedError(); | 37 testDelayedError(); |
39 } | 38 } |
40 | 39 |
OLD | NEW |