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

Side by Side Diff: tests/language/throw1_test.dart

Issue 10891020: Update almost all tests (except co19) to use the new try-catch syntax. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge. Created 8 years, 3 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
« no previous file with comments | « tests/language/syntax_test.dart ('k') | tests/language/throw2_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 throw statement 4 // Dart test program for testing throw statement
5 5
6 interface TestException { 6 interface TestException {
7 String getMessage(); 7 String getMessage();
8 } 8 }
9 9
10 class MyException implements TestException { 10 class MyException implements TestException {
(...skipping 15 matching lines...) Expand all
26 } 26 }
27 27
28 class Helper { 28 class Helper {
29 static int f1(int i) { 29 static int f1(int i) {
30 try { 30 try {
31 int j; 31 int j;
32 j = func(); 32 j = func();
33 if (j > 0) { 33 if (j > 0) {
34 throw new MyException2("Test for exception being thrown"); 34 throw new MyException2("Test for exception being thrown");
35 } 35 }
36 } catch (MyException3 exception) { 36 } on MyException3 catch (exception) {
37 i = 100; 37 i = 100;
38 print(exception.getMessage()); 38 print(exception.getMessage());
39 } catch (TestException exception) { 39 } on TestException catch (exception) {
40 i = 50; 40 i = 50;
41 print(exception.getMessage()); 41 print(exception.getMessage());
42 } catch (MyException2 exception) { 42 } on MyException2 catch (exception) {
43 i = 150; 43 i = 150;
44 print(exception.getMessage()); 44 print(exception.getMessage());
45 } catch (MyException exception) { 45 } on MyException catch (exception) {
46 i = 200; 46 i = 200;
47 print(exception.getMessage()); 47 print(exception.getMessage());
48 } finally { 48 } finally {
49 i = i + 800; 49 i = i + 800;
50 } 50 }
51 return i; 51 return i;
52 } 52 }
53 53
54 static int func() { 54 static int func() {
55 int i = 0; 55 int i = 0;
56 while (i < 10) { 56 while (i < 10) {
57 i++; 57 i++;
58 } 58 }
59 return i; 59 return i;
60 } 60 }
61 } 61 }
62 62
63 class Throw1Test { 63 class Throw1Test {
64 static testMain() { 64 static testMain() {
65 Expect.equals(850, Helper.f1(1)); 65 Expect.equals(850, Helper.f1(1));
66 } 66 }
67 } 67 }
68 68
69 main() { 69 main() {
70 Throw1Test.testMain(); 70 Throw1Test.testMain();
71 } 71 }
OLDNEW
« no previous file with comments | « tests/language/syntax_test.dart ('k') | tests/language/throw2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698