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

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

Issue 14009004: Remove methods on StackTrace class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 8 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
1 // (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // (c) 2013, the Dart project authors. Please see the AUTHORS file
Ivan Posva 2013/04/12 03:13:10 Where is the difference between this file and full
Lasse Reichstein Nielsen 2013/04/15 11:37:22 See below.
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 6
7 // This test assumes that all called functions occur in the stack trace.
8 // This might not be the case if inlining methods.
9
7 void func1() { 10 void func1() {
8 throw new Exception("Test peanut gallery request for Full stacktrace"); 11 throw new Exception("Test full stacktrace");
9 } 12 }
10 void func2() { 13 void func2() {
11 func1(); 14 func1();
12 } 15 }
13 void func3() { 16 void func3() {
14 try { 17 try {
15 func2(); 18 func2();
16 } on Object catch(e, s) { 19 } on Object catch(e, s) {
17 print(e); 20 var fullTrace = s.toString();
18 var full_trace = s.fullStackTrace; 21 Expect.isTrue(fullTrace.contains("func1"));
19 Expect.isTrue(full_trace.contains("func1")); 22 Expect.isTrue(fullTrace.contains("func2"));
20 Expect.isTrue(full_trace.contains("func2")); 23 Expect.isTrue(fullTrace.contains("func3"));
21 Expect.isTrue(full_trace.contains("func3")); 24 Expect.isTrue(fullTrace.contains("func4"));
22 Expect.isTrue(full_trace.contains("func4")); 25 Expect.isTrue(fullTrace.contains("func5"));
23 Expect.isTrue(full_trace.contains("func5")); 26 Expect.isTrue(fullTrace.contains("func6"));
24 Expect.isTrue(full_trace.contains("func6")); 27 Expect.isTrue(fullTrace.contains("func7"));
25 Expect.isTrue(full_trace.contains("func7")); 28 Expect.isTrue(fullTrace.contains("main"));
26 Expect.isTrue(full_trace.contains("main"));
27
28 var trace = s.stackTrace;
29 Expect.isTrue(trace.contains("func1"));
30 Expect.isTrue(trace.contains("func2"));
31 Expect.isTrue(trace.contains("func3"));
32
33 Expect.isFalse(trace.contains("func4"));
34 Expect.isFalse(trace.contains("func5"));
35 Expect.isFalse(trace.contains("func6"));
36 Expect.isFalse(trace.contains("func7"));
37 Expect.isFalse(trace.contains("main"));
38
39 print(s);
40
41 print("Full stack trace");
42 print(full_trace);
43
44 print("Stack trace");
45 print(trace);
46 throw new Exception("This is not a rethrow"); 29 throw new Exception("This is not a rethrow");
Lasse Reichstein Nielsen 2013/04/15 11:37:22 This is a rethrow in full_stacktrace2_test.dart.
47 } 30 }
48 } 31 }
49 int func4() { 32 int func4() {
50 func3(); 33 func3();
51 return 1; 34 return 1;
52 } 35 }
53 int func5() { 36 int func5() {
54 try { 37 try {
55 func4(); 38 func4();
56 } on Object catch(e, s) { 39 } on Object catch(e, s) {
57 var full_trace = s.fullStackTrace; 40 var fullTrace = s.toString();
58 Expect.isFalse(full_trace.contains("func1")); 41 Expect.isFalse(fullTrace.contains("func1"));
59 Expect.isFalse(full_trace.contains("func2")); 42 Expect.isFalse(fullTrace.contains("func2"));
60 Expect.isTrue(full_trace.contains("func3")); 43 Expect.isTrue(fullTrace.contains("func3"));
61 Expect.isTrue(full_trace.contains("func4")); 44 Expect.isTrue(fullTrace.contains("func4"));
62 Expect.isTrue(full_trace.contains("func5")); 45 Expect.isTrue(fullTrace.contains("func5"));
63 Expect.isTrue(full_trace.contains("func6")); 46 Expect.isTrue(fullTrace.contains("func6"));
64 Expect.isTrue(full_trace.contains("func7")); 47 Expect.isTrue(fullTrace.contains("func7"));
65 Expect.isTrue(full_trace.contains("main")); 48 Expect.isTrue(fullTrace.contains("main"));
66
67 var trace = s.stackTrace;
68 Expect.isFalse(trace.contains("func1"));
69 Expect.isFalse(trace.contains("func2"));
70
71 Expect.isTrue(trace.contains("func3"));
72 Expect.isTrue(trace.contains("func4"));
73 Expect.isTrue(trace.contains("func5"));
74
75 Expect.isFalse(trace.contains("func6"));
76 Expect.isFalse(trace.contains("func7"));
77 Expect.isFalse(trace.contains("main"));
78
79 print(s);
80
81 print("Full stack trace");
82 print(full_trace);
83
84 print("Stack trace");
85 print(trace);
86 } 49 }
87 return 1; 50 return 1;
88 } 51 }
89 int func6() { 52 int func6() {
90 func5(); 53 func5();
91 return 1; 54 return 1;
92 } 55 }
93 int func7() { 56 int func7() {
94 func6(); 57 func6();
95 return 1; 58 return 1;
96 } 59 }
97 main() { 60 main() {
98 var i = func7(); 61 var i = func7();
99 Expect.equals(1, i); 62 Expect.equals(1, i);
100 } 63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698