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