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

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

Issue 14009004: Remove methods on StackTrace class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add dart2j issue number for unexepected stack trace. 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
« no previous file with comments | « tests/language/full_stacktrace1_test.dart ('k') | tests/language/full_stacktrace3_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
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 void func1() { 7 void func1() {
8 throw new Exception("Test peanut gallery request for Full stacktrace"); 8 throw new Exception("Test full stacktrace");
9 } 9 }
10 void func2() { 10 void func2() {
11 func1(); 11 func1();
12 } 12 }
13 void func3() { 13 void func3() {
14 try { 14 try {
15 func2(); 15 func2();
16 } on Object catch(e, s) { 16 } on Object catch(e, s) {
17 print(e); 17 var fullTrace = s.toString();
18 18 Expect.isTrue(fullTrace.contains("func1"));
19 var full_trace = s.fullStackTrace; 19 Expect.isTrue(fullTrace.contains("func2"));
20 Expect.isTrue(full_trace.contains("func1")); 20 Expect.isTrue(fullTrace.contains("func3"));
21 Expect.isTrue(full_trace.contains("func2")); 21 Expect.isTrue(fullTrace.contains("func4"));
22 Expect.isTrue(full_trace.contains("func3")); 22 Expect.isTrue(fullTrace.contains("func5"));
23 Expect.isTrue(full_trace.contains("func4")); 23 Expect.isTrue(fullTrace.contains("func6"));
24 Expect.isTrue(full_trace.contains("func5")); 24 Expect.isTrue(fullTrace.contains("func7"));
25 Expect.isTrue(full_trace.contains("func6")); 25 Expect.isTrue(fullTrace.contains("main"));
26 Expect.isTrue(full_trace.contains("func7"));
27 Expect.isTrue(full_trace.contains("main"));
28
29 var trace = s.stackTrace;
30 Expect.isTrue(trace.contains("func1"));
31 Expect.isTrue(trace.contains("func2"));
32 Expect.isTrue(trace.contains("func3"));
33
34 Expect.isFalse(trace.contains("func4"));
35 Expect.isFalse(trace.contains("func5"));
36 Expect.isFalse(trace.contains("func6"));
37 Expect.isFalse(trace.contains("func7"));
38 Expect.isFalse(trace.contains("main"));
39
40 print(s);
41
42 print("Full stack trace");
43 print(full_trace);
44
45 print("Stack trace");
46 print(trace);
47 26
48 throw; // This is a rethrow. 27 throw; // This is a rethrow.
49 } 28 }
50 } 29 }
51 int func4() { 30 int func4() {
52 func3(); 31 func3();
53 return 1; 32 return 1;
54 } 33 }
55 int func5() { 34 int func5() {
56 try { 35 try {
57 func4(); 36 func4();
58 } on Object catch(e, s) { 37 } on Object catch(e, s) {
59 38 var fullTrace = s.toString();
60 var full_trace = s.fullStackTrace; 39 Expect.isTrue(fullTrace.contains("func1"));
61 print(full_trace); 40 Expect.isTrue(fullTrace.contains("func2"));
62 Expect.isTrue(full_trace.contains("func1")); 41 Expect.isTrue(fullTrace.contains("func3"));
63 Expect.isTrue(full_trace.contains("func2")); 42 Expect.isTrue(fullTrace.contains("func4"));
64 Expect.isTrue(full_trace.contains("func3")); 43 Expect.isTrue(fullTrace.contains("func5"));
65 Expect.isTrue(full_trace.contains("func4")); 44 Expect.isTrue(fullTrace.contains("func6"));
66 Expect.isTrue(full_trace.contains("func5")); 45 Expect.isTrue(fullTrace.contains("func7"));
67 Expect.isTrue(full_trace.contains("func6")); 46 Expect.isTrue(fullTrace.contains("main"));
68 Expect.isTrue(full_trace.contains("func7"));
69 Expect.isTrue(full_trace.contains("main"));
70
71 var trace = s.stackTrace;
72 Expect.isTrue(trace.contains("func1"));
73 Expect.isTrue(trace.contains("func2"));
74 Expect.isTrue(trace.contains("func3"));
75 Expect.isTrue(trace.contains("func4"));
76 Expect.isTrue(trace.contains("func5"));
77
78 Expect.isFalse(trace.contains("func6"));
79 Expect.isFalse(trace.contains("func7"));
80 Expect.isFalse(trace.contains("main"));
81
82 print(s);
83
84 print("Full stack trace");
85 print(full_trace);
86
87 print("Stack trace");
88 print(trace);
89 } 47 }
90 return 1; 48 return 1;
91 } 49 }
92 int func6() { 50 int func6() {
93 func5(); 51 func5();
94 return 1; 52 return 1;
95 } 53 }
96 int func7() { 54 int func7() {
97 func6(); 55 func6();
98 return 1; 56 return 1;
99 } 57 }
100 main() { 58 main() {
101 var i = func7(); 59 var i = func7();
102 Expect.equals(1, i); 60 Expect.equals(1, i);
103 } 61 }
OLDNEW
« no previous file with comments | « tests/language/full_stacktrace1_test.dart ('k') | tests/language/full_stacktrace3_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698