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

Side by Side Diff: tests/language/src/Throw1Test.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, 7 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/ThisTest.dart ('k') | tests/language/src/Throw2Test.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 if (j > 0) {
34 throw new MyException2("Test for exception being thrown");
35 }
36 } catch (MyException3 exception) {
37 i = 100;
38 print(exception.getMessage());
39 } catch (TestException exception) {
40 i = 50;
41 print(exception.getMessage());
42 } catch (MyException2 exception) {
43 i = 150;
44 print(exception.getMessage());
45 } catch (MyException exception) {
46 i = 200;
47 print(exception.getMessage());
48 } finally {
49 i = i + 800;
50 }
51 return i;
52 }
53
54 static int func() {
55 int i = 0;
56 while (i < 10) {
57 i++;
58 }
59 return i;
60 }
61 }
62
63 class Throw1Test {
64 static testMain() {
65 Expect.equals(850, Helper.f1(1));
66 }
67 }
68
69 main() {
70 Throw1Test.testMain();
71 }
OLDNEW
« no previous file with comments | « tests/language/src/ThisTest.dart ('k') | tests/language/src/Throw2Test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698