OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 import "package:async_helper/async_helper.dart"; | 6 import "package:async_helper/async_helper.dart"; |
7 | 7 |
8 then43() async { | 8 then43() async { |
9 label: try { | 9 label: |
| 10 try { |
10 return await 42; | 11 return await 42; |
11 } finally { | 12 } finally { |
12 break label; | 13 break label; |
13 } | 14 } |
14 return await 43; | 15 return await 43; |
15 } | 16 } |
16 | 17 |
17 then42() async { | 18 then42() async { |
18 label: try { | 19 label: |
| 20 try { |
19 return await 42; | 21 return await 42; |
20 } finally { | 22 } finally {} |
21 } | |
22 return await 43; | 23 return await 43; |
23 } | 24 } |
24 | 25 |
25 now43() { | 26 now43() { |
26 label: try { | 27 label: |
| 28 try { |
27 return 42; | 29 return 42; |
28 } finally { | 30 } finally { |
29 break label; | 31 break label; |
30 } | 32 } |
31 return 43; | 33 return 43; |
32 } | 34 } |
33 | 35 |
34 now42() { | 36 now42() { |
35 label: try { | 37 label: |
| 38 try { |
36 return 42; | 39 return 42; |
37 } finally { | 40 } finally {} |
38 } | |
39 return 43; | 41 return 43; |
40 } | 42 } |
41 | 43 |
42 test() async { | 44 test() async { |
43 Expect.equals(42, await then42()); | 45 Expect.equals(42, await then42()); |
44 Expect.equals(43, await then43()); | 46 Expect.equals(43, await then43()); |
45 Expect.equals(42, now42()); | 47 Expect.equals(42, now42()); |
46 Expect.equals(43, now43()); | 48 Expect.equals(43, now43()); |
47 } | 49 } |
48 | 50 |
49 main() { | 51 main() { |
50 asyncStart(); | 52 asyncStart(); |
51 test().then((_) => asyncEnd()); | 53 test().then((_) => asyncEnd()); |
52 } | 54 } |
OLD | NEW |