| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 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 | 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 class MyException { } | 5 class MyException { } |
| 6 | 6 |
| 7 class MyException1 extends MyException { } | 7 class MyException1 extends MyException { } |
| 8 | 8 |
| 9 class MyException2 extends MyException { } | 9 class MyException2 extends MyException { } |
| 10 | 10 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 var caught = false; | 116 var caught = false; |
| 117 try { | 117 try { |
| 118 throw new MyException(); | 118 throw new MyException(); |
| 119 } catch (exc) { | 119 } catch (exc) { |
| 120 caught = true; | 120 caught = true; |
| 121 } | 121 } |
| 122 Expect.equals(true, caught); | 122 Expect.equals(true, caught); |
| 123 Expect.equals(3, e); | 123 Expect.equals(3, e); |
| 124 } | 124 } |
| 125 | 125 |
| 126 static void test9() { |
| 127 var e = 6; |
| 128 try { |
| 129 throw "up"; |
| 130 } on String { |
| 131 e = "s"; |
| 132 } on int { |
| 133 e = "i"; |
| 134 } |
| 135 Expect.equals("s", e); |
| 136 } |
| 137 |
| 126 static void testMain() { | 138 static void testMain() { |
| 127 test1(); | 139 test1(); |
| 128 test2(); | 140 test2(); |
| 129 test3(); | 141 test3(); |
| 130 test4(); | 142 test4(); |
| 131 test5(); | 143 test5(); |
| 132 test6(); | 144 test6(); |
| 133 test7(); | 145 test7(); |
| 134 test8(); | 146 test8(); |
| 147 test9(); |
| 135 } | 148 } |
| 136 } | 149 } |
| 137 | 150 |
| 138 main() { | 151 main() { |
| 139 TryCatchTest.testMain(); | 152 TryCatchTest.testMain(); |
| 140 } | 153 } |
| OLD | NEW |