Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: tests/language/src/TryCatch3NegativeTest.dart

Issue 9162001: Updating crufty tests, remove invalid TryCatch8NegativeTest (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 as duplicate var definition 6 // Negative test should fail compilation as duplicate var definition
7 7
gbracha 2012/01/09 21:56:45 it might be good to be more specific: duplicate de
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() { }
20 } 19 }
21 20
22 class Helper { 21 class Helper {
23 static int f1(int i) { 22 static int f1(int i) {
24 try { 23 try {
25 int j; 24 int j;
26 j = f2(); 25 j = f2();
27 j = f3(); 26 j = f3();
28 } catch (TestException e, StackTrace e) { 27 } catch (TestException e, StackTrace e) {
29 i = 200; 28 i = 200;
30 } 29 }
31 return i; 30 return i;
32 } 31 }
33 32
34 static int f2() { 33 static int f2() {
35 return 2; 34 return 2;
36 } 35 }
37 36
38 static int f3() { 37 static int f3() {
39 int i = 0; 38 int i = 0;
40 while (i < 10) { 39 while (i < 10) {
41 i++; 40 i++;
42 } 41 }
43 return i; 42 return i;
44 } 43 }
45 } 44 }
46 45
47 class TryCatch3NegativeTest {
48 static testMain() {
49 Expect.equals(1, Helper.f1(1));
50 }
51 }
52
53 main() { 46 main() {
54 TryCatch3NegativeTest.testMain(); 47 Expect.equals(1, Helper.f1(1));
55 } 48 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698