| Index: tests/language/try_catch_on_syntax_test.dart
|
| ===================================================================
|
| --- tests/language/try_catch_on_syntax_test.dart (revision 44525)
|
| +++ tests/language/try_catch_on_syntax_test.dart (working copy)
|
| @@ -10,34 +10,39 @@
|
|
|
| class MyException2 extends MyException { }
|
|
|
| -class TryCatchTest {
|
| - static void test1() {
|
| - var foo = 0;
|
| - try {
|
| - throw new MyException1();
|
| - }
|
| - on on MyException2 catch (e) { } /// 02: compile-time error
|
| - catch MyException2 catch (e) { } /// 03: compile-time error
|
| - catch catch catch (e) { } /// 04: compile-time error
|
| - on (e) { } /// 05: compile-time error
|
| - catch MyException2 catch (e) { } /// 06: compile-time error
|
| - on MyException2 catch (e) {
|
| - foo = 1;
|
| - } on MyException1 catch (e) {
|
| - foo = 2;
|
| - } on MyException catch (e) {
|
| - foo = 3;
|
| - }
|
| - on UndefinedClass /// 07: static type warning
|
| - catch(e) { foo = 4; }
|
| - Expect.equals(2, foo);
|
| +void test1() {
|
| + var foo = 0;
|
| + try {
|
| + throw new MyException1();
|
| }
|
| -
|
| - static void testMain() {
|
| - test1();
|
| + on on MyException2 catch (e) { } /// 02: compile-time error
|
| + catch MyException2 catch (e) { } /// 03: compile-time error
|
| + catch catch catch (e) { } /// 04: compile-time error
|
| + on (e) { } /// 05: compile-time error
|
| + catch MyException2 catch (e) { } /// 06: compile-time error
|
| + on MyException2 catch (e) {
|
| + foo = 1;
|
| + } on MyException1 catch (e) {
|
| + foo = 2;
|
| + } on MyException catch (e) {
|
| + foo = 3;
|
| }
|
| + on UndefinedClass /// 07: static type warning
|
| + catch(e) { foo = 4; }
|
| + Expect.equals(2, foo);
|
| }
|
|
|
| +testFinal() {
|
| + try {
|
| + throw "catch this!";
|
| + } catch (e, s) {
|
| + // Test that the error and stack trace variables are final.
|
| + e = null; /// 10: runtime error
|
| + s = null; /// 11: runtime error
|
| + }
|
| +}
|
| +
|
| main() {
|
| - TryCatchTest.testMain();
|
| + test1();
|
| + testFinal();
|
| }
|
|
|