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

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

Issue 12316116: Add functionality to get full stack trace when exceptions are thrown. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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
(Empty)
1 void func1() {
2 throw new Exception("Test peanut gallery request for Full stacktrace");
3 }
4 void func2() {
5 func1();
6 }
7 void func3() {
8 try {
9 func2();
10 } on Object catch(e, s) {
11 print(e);
12 var full_trace = s.fullStacktrace;
13 Expect.isTrue(full_trace.contains("func1"));
14 Expect.isTrue(full_trace.contains("func2"));
15 Expect.isTrue(full_trace.contains("func3"));
16 Expect.isTrue(full_trace.contains("func4"));
17 Expect.isTrue(full_trace.contains("func5"));
18 Expect.isTrue(full_trace.contains("func6"));
19 Expect.isTrue(full_trace.contains("func7"));
20 Expect.isTrue(full_trace.contains("main"));
21
22 var trace = s.stacktrace;
23 Expect.isTrue(trace.contains("func1"));
24 Expect.isTrue(trace.contains("func2"));
25 Expect.isTrue(trace.contains("func3"));
26
27 Expect.isFalse(trace.contains("func4"));
28 Expect.isFalse(trace.contains("func5"));
29 Expect.isFalse(trace.contains("func6"));
30 Expect.isFalse(trace.contains("func7"));
31 Expect.isFalse(trace.contains("main"));
32
33 print("Full stack trace");
34 print(full_trace);
35 print("Stack trace");
36 print(trace);
37 throw new Exception("This is not a rethrow");
38 }
39 }
40 int func4() {
41 func3();
42 return 1;
43 }
44 int func5() {
45 try {
46 func4();
47 } on Object catch(e, s) {
48 var full_trace = s.fullStacktrace;
49 Expect.isFalse(full_trace.contains("func1"));
50 Expect.isFalse(full_trace.contains("func2"));
51 Expect.isTrue(full_trace.contains("func3"));
52 Expect.isTrue(full_trace.contains("func4"));
53 Expect.isTrue(full_trace.contains("func5"));
54 Expect.isTrue(full_trace.contains("func6"));
55 Expect.isTrue(full_trace.contains("func7"));
56 Expect.isTrue(full_trace.contains("main"));
57
58 var trace = s.stacktrace;
59 Expect.isFalse(trace.contains("func1"));
60 Expect.isFalse(trace.contains("func2"));
61
62 Expect.isTrue(trace.contains("func3"));
63 Expect.isTrue(trace.contains("func4"));
64 Expect.isTrue(trace.contains("func5"));
65
66 Expect.isFalse(trace.contains("func6"));
67 Expect.isFalse(trace.contains("func7"));
68 Expect.isFalse(trace.contains("main"));
69
70 print("Full stack trace");
71 print(full_trace);
72 print("Stack trace");
73 print(trace);
74 }
75 return 1;
76 }
77 int func6() {
78 func5();
79 return 1;
80 }
81 int func7() {
82 func6();
83 return 1;
84 }
85 main() {
86 var i = func7();
87 Expect.equals(1, i);
88 }
OLDNEW
« sdk/lib/core/exceptions.dart ('K') | « tests/language/full_stacktrace2_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698