OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 | 6 |
7 var trace = ""; | 7 var trace = ""; |
8 | 8 |
9 main() { | 9 main() { |
10 var x = 0; | 10 var x = 0; |
11 try { | 11 try { |
12 try { | 12 try { |
13 throw x++; // 1 | 13 throw x++; // 1 |
14 } on int catch (e) { | 14 } on int catch (e) { |
15 trace += "$e"; | 15 trace += "$e"; |
16 trace += "-$x"; | 16 trace += "-$x"; |
17 x++; // 2 | 17 x++; // 2 |
18 try { | 18 try { |
19 x++; // 3 | 19 x++; // 3 |
20 rethrow; | 20 rethrow; |
21 } finally { | 21 } finally { |
22 trace += "-f"; | 22 trace += "-f"; |
23 x++; // 4 | 23 x++; // 4 |
24 } | 24 } |
25 } | 25 } |
26 } catch (e) { | 26 } catch (e) { |
27 trace += "-c"; | 27 trace += "-c"; |
28 trace += "-$e"; | 28 trace += "-$e"; |
29 trace += "-$x"; | 29 trace += "-$x"; |
30 } | 30 } |
31 Expect.equals("0-1-f-c-0-4", trace); | 31 Expect.equals("0-1-f-c-0-4", trace); |
32 } | 32 } |
OLD | NEW |