| 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 // 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. | 5 // being thrown. |
| 6 // Negative test should fail compilation illegal finally specifier. | 6 // Negative test should fail compilation illegal finally specifier. |
| 7 | 7 |
| 8 interface TestException { | 8 interface TestException { |
| 9 String getMessage(); | 9 String getMessage(); |
| 10 } | 10 } |
| 11 | 11 |
| 12 class MyException implements TestException { | 12 class MyException implements TestException { |
| 13 const MyException(String message = "") : message_ = message; | 13 const MyException([String message = ""]) : message_ = message; |
| 14 String getMessage() { return message_; } | 14 String getMessage() { return message_; } |
| 15 final String message_; | 15 final String message_; |
| 16 } | 16 } |
| 17 | 17 |
| 18 class StackTrace { | 18 class StackTrace { |
| 19 StackTrace() { } | 19 StackTrace() { } |
| 20 } | 20 } |
| 21 | 21 |
| 22 class Helper { | 22 class Helper { |
| 23 static int f1(int i) { | 23 static int f1(int i) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 static int f3() { | 38 static int f3() { |
| 39 int i = 0; | 39 int i = 0; |
| 40 while (i < 10) { | 40 while (i < 10) { |
| 41 i++; | 41 i++; |
| 42 } | 42 } |
| 43 return i; | 43 return i; |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 | 46 |
| 47 class TryCatch4NegativeTest { | |
| 48 static testMain() { | |
| 49 Expect.equals(1, Helper.f1(1)); | |
| 50 } | |
| 51 } | |
| 52 | |
| 53 main() { | 47 main() { |
| 54 TryCatch4NegativeTest.testMain(); | 48 Expect.equals(1, Helper.f1(1)); |
| 55 } | 49 } |
| OLD | NEW |