OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014, 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 // Regression test for issue 18869: Check that try-catch is working correctly |
| 6 // inside switch-case clauses. |
| 7 |
| 8 |
| 9 import "package:expect/expect.dart"; |
| 10 |
| 11 test_switch() { |
| 12 switch(0) { |
| 13 _0: case 0: |
| 14 print("_0"); |
| 15 continue _5; |
| 16 _1: case 1: |
| 17 try { |
| 18 print("bunny"); |
| 19 continue _6; |
| 20 } catch(e) { } |
| 21 break; |
| 22 _5: case 5: |
| 23 print("_5"); |
| 24 continue _6; |
| 25 _6: case 6: |
| 26 print("_6"); |
| 27 throw 555; |
| 28 } |
| 29 } |
| 30 |
| 31 main() { |
| 32 Expect.throws(() => test_switch(), (e) => e == 555); |
| 33 } |
OLD | NEW |