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

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, 9 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() {
kasperl 2013/04/08 14:07:52 Copyright notice.
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;
kasperl 2013/04/08 14:07:52 fullTrace
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(s);
33
34 print("Full stack trace");
35 print(full_trace);
36
37 print("Stack trace");
38 print(trace);
39 }
40 }
41 int func4() {
42 func3();
43 return 1;
44 }
45 int func5() {
46 func4();
47 return 1;
48 }
49 int func6() {
50 func5();
51 return 1;
52 }
53 main() {
54 var i = func6();
55 Expect.equals(1, i);
56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698