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

Side by Side Diff: tests/language/full_stacktrace1_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
13 var full_trace = s.fullStacktrace;
14 Expect.isTrue(full_trace.contains("func1"));
15 Expect.isTrue(full_trace.contains("func2"));
16 Expect.isTrue(full_trace.contains("func3"));
17 Expect.isTrue(full_trace.contains("func4"));
18 Expect.isTrue(full_trace.contains("func5"));
19 Expect.isTrue(full_trace.contains("func6"));
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("main"));
31
32 print("Full stack trace");
33 print(full_trace);
34 print("Stack trace");
35 print(trace);
36 }
37 }
38 int func4() {
39 func3();
40 return 1;
41 }
42 int func5() {
43 func4();
44 return 1;
45 }
46 int func6() {
47 func5();
48 return 1;
49 }
50 main() {
51 var i = func6();
52 Expect.equals(1, i);
53 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698