OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011, 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 // Dart test program for testing throw statement |
| 5 |
| 6 import "package:expect/expect.dart"; |
| 7 |
| 8 var finallyExecutionCount = 0; |
| 9 bar() { |
| 10 try { |
| 11 try { |
| 12 return 499; |
| 13 } catch (e, st) { |
| 14 rethrow; |
| 15 } |
| 16 } finally { |
| 17 finallyExecutionCount++; |
| 18 throw "quit finally with throw"; |
| 19 } |
| 20 } |
| 21 |
| 22 main() { |
| 23 bool hasThrown = false; |
| 24 try { |
| 25 bar(); |
| 26 } catch (x) { |
| 27 hasThrown = true; |
| 28 Expect.equals(1, finallyExecutionCount); |
| 29 } |
| 30 Expect.isTrue(hasThrown); |
| 31 } |
OLD | NEW |