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

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

Issue 10248007: test rename overhaul: step 8 - language tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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/src/Throw1Test.dart ('k') | tests/language/src/Throw3Test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4 // Dart test program for testing throw statement
5
6 interface TestException {
7 String getMessage();
8 }
9
10 class MyException implements TestException {
11 const MyException([String message = ""]) : message_ = message;
12 String getMessage() { return message_; }
13 final String message_;
14 }
15
16 class MyException2 implements TestException {
17 const MyException2([String message = ""]) : message_ = message;
18 String getMessage() { return message_; }
19 final String message_;
20 }
21
22 class MyException3 implements TestException {
23 const MyException3([String message = ""]) : message_ = message;
24 String getMessage() { return message_; }
25 final String message_;
26 }
27
28 class Helper {
29 static int f1(int i) {
30 try {
31 int j;
32 j = func();
33 } catch (MyException3 exception) {
34 i = 100;
35 print(exception.getMessage());
36 } catch (MyException2 exception) {
37 try {
38 i = func2();
39 i = 200;
40 } catch (TestException exception) {
41 i = 50;
42 }
43 print(exception.getMessage());
44 } catch (MyException exception) {
45 i = func2();
46 print(exception.getMessage());
47 } finally {
48 i = i + 800;
49 }
50 return i;
51 }
52
53 static int func() {
54 int i = 0;
55 while (i < 10) {
56 i++;
57 }
58 if (i > 0) {
59 throw new MyException2("Test for exception being thrown");
60 }
61 return i;
62 }
63
64 static int func2() {
65 int i = 0;
66 while (i < 10) {
67 i++;
68 }
69 if (i > 0) {
70 throw new MyException2("Test for exception being thrown");
71 }
72 return i;
73 }
74 }
75
76 class Throw2Test {
77 static testMain() {
78 Expect.equals(850, Helper.f1(1));
79 }
80 }
81
82 main() {
83 Throw2Test.testMain();
84 }
OLDNEW
« no previous file with comments | « tests/language/src/Throw1Test.dart ('k') | tests/language/src/Throw3Test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698