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

Side by Side Diff: tests/language/src/StackTraceTest.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/StackOverflowTest.dart ('k') | tests/language/src/StatementTest.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 class MyException {
7 const MyException(String message) : message_ = message;
8 final String message_;
9 }
10
11 class Helper {
12 static int f1(int i) {
13 try {
14 i = func();
15 i = 10;
16 } catch (MyException exception, var stacktrace) {
17 i = 50;
18 print(exception.message_);
19 Expect.equals((stacktrace != null), true);
20 print(stacktrace);
21 }
22 try {
23 int j;
24 i = func1();
25 i = 200;
26 } catch (MyException exception, var stacktrace) {
27 i = 50;
28 print(exception.message_);
29 Expect.equals((stacktrace != null), true);
30 print(stacktrace);
31 }
32 try {
33 int j;
34 i = func2();
35 i = 200;
36 } catch (MyException exception, var stacktrace) {
37 i = 50;
38 print(exception.message_);
39 Expect.equals((stacktrace != null), true);
40 print(stacktrace);
41 } finally {
42 i = i + 800;
43 }
44 return i;
45 }
46
47 static int func() {
48 int i = 0;
49 while (i < 10) {
50 i++;
51 }
52 if (i > 0) {
53 throw new MyException("Exception Test for stack trace being printed");
54 }
55 return 10;
56 }
57
58 static int func1() {
59 try {
60 func();
61 } catch (MyException exception) {
62 throw new MyException("Exception Test for stack trace being printed");;
63 }
64 return 10;
65 }
66
67 static int func2() {
68 try {
69 func();
70 } catch (MyException exception) {
71 throw;
72 }
73 return 10;
74 }
75
76 }
77
78 class StackTraceTest {
79 static testMain() {
80 Expect.equals(850, Helper.f1(1));
81 }
82 }
83
84 main() {
85 StackTraceTest.testMain();
86 }
OLDNEW
« no previous file with comments | « tests/language/src/StackOverflowTest.dart ('k') | tests/language/src/StatementTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698