OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 import "package:expect/expect.dart"; |
| 6 import "package:async_helper/async_helper.dart"; |
| 7 |
| 8 then43() async { |
| 9 label: try { |
| 10 return await 42; |
| 11 } finally { |
| 12 break label; |
| 13 } |
| 14 return await 43; |
| 15 } |
| 16 |
| 17 then42() async { |
| 18 label: try { |
| 19 return await 42; |
| 20 } finally { |
| 21 } |
| 22 return await 43; |
| 23 } |
| 24 |
| 25 now43() { |
| 26 label: try { |
| 27 return 42; |
| 28 } finally { |
| 29 break label; |
| 30 } |
| 31 return 43; |
| 32 } |
| 33 |
| 34 now42() { |
| 35 label: try { |
| 36 return 42; |
| 37 } finally { |
| 38 } |
| 39 return 43; |
| 40 } |
| 41 |
| 42 test() async { |
| 43 Expect.equals(42, await then42()); |
| 44 Expect.equals(43, await then43()); |
| 45 Expect.equals(42, now42()); |
| 46 Expect.equals(43, now43()); |
| 47 } |
| 48 |
| 49 main() { |
| 50 asyncStart(); |
| 51 test().then((_) => asyncEnd()); |
| 52 } |
OLD | NEW |