| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // Dart test program for testing try/catch statement without any exceptions | 4 // Dart test program for testing try/catch statement without any exceptions |
| 5 // being thrown. (Nested try/catch blocks). | 5 // being thrown. (Nested try/catch blocks). |
| 6 // VMOptions=--optimization-counter-threshold=10 --no-background-compilation | 6 // VMOptions=--optimization-counter-threshold=10 --no-background-compilation |
| 7 | 7 |
| 8 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
| 9 | 9 |
| 10 abstract class TestException { | 10 abstract class TestException { |
| 11 String getMessage(); | 11 String getMessage(); |
| 12 } | 12 } |
| 13 | 13 |
| 14 class MyException implements TestException { | 14 class MyException implements TestException { |
| 15 const MyException([String message = ""]) : message_ = message; | 15 const MyException([String message = ""]) : message_ = message; |
| 16 String getMessage() { return message_; } | 16 String getMessage() { |
| 17 return message_; |
| 18 } |
| 19 |
| 17 final String message_; | 20 final String message_; |
| 18 } | 21 } |
| 19 | 22 |
| 20 class StackTrace { | 23 class StackTrace { |
| 21 StackTrace() { } | 24 StackTrace() {} |
| 22 } | 25 } |
| 23 | 26 |
| 24 class Helper { | 27 class Helper { |
| 25 static int f1(int i) { | 28 static int f1(int i) { |
| 26 try { | 29 try { |
| 27 int j; | 30 int j; |
| 28 j = f2(); | 31 j = f2(); |
| 29 i = i + 1; | 32 i = i + 1; |
| 30 try { | 33 try { |
| 31 j = f2() + f3() + j; | 34 j = f2() + f3() + j; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 59 static testMain() { | 62 static testMain() { |
| 60 Expect.equals(3, Helper.f1(1)); | 63 Expect.equals(3, Helper.f1(1)); |
| 61 } | 64 } |
| 62 } | 65 } |
| 63 | 66 |
| 64 main() { | 67 main() { |
| 65 for (var i = 0; i < 20; i++) { | 68 for (var i = 0; i < 20; i++) { |
| 66 TryCatch2Test.testMain(); | 69 TryCatch2Test.testMain(); |
| 67 } | 70 } |
| 68 } | 71 } |
| OLD | NEW |