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

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: 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_stacktrace2_test.dart ('k') | tests/language/language_dart2js.status » ('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 var full_trace = s.fullStackTrace; 18 Expect.isTrue(fullTrace.contains("func1"));
19 Expect.isTrue(full_trace.contains("func1")); 19 Expect.isTrue(fullTrace.contains("func2"));
20 Expect.isTrue(full_trace.contains("func2")); 20 Expect.isTrue(fullTrace.contains("func3"));
21 Expect.isTrue(full_trace.contains("func3")); 21 Expect.isTrue(fullTrace.contains("func4"));
22 Expect.isTrue(full_trace.contains("func4")); 22 Expect.isTrue(fullTrace.contains("func5"));
23 Expect.isTrue(full_trace.contains("func5")); 23 Expect.isTrue(fullTrace.contains("func6"));
24 Expect.isTrue(full_trace.contains("func6")); 24 Expect.isTrue(fullTrace.contains("func7"));
25 Expect.isTrue(full_trace.contains("func7")); 25 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"); 26 throw new Exception("This is not a rethrow");
47 } 27 }
48 } 28 }
49 int func4() { 29 int func4() {
50 func3(); 30 func3();
51 return 1; 31 return 1;
52 } 32 }
53 int func5() { 33 int func5() {
54 try { 34 try {
55 func4(); 35 func4();
56 } on Object catch(e, s) { 36 } on Object catch(e, s) {
57 var full_trace = s.fullStackTrace; 37 var fullTrace = s.toString();
58 Expect.isFalse(full_trace.contains("func1")); 38 Expect.isFalse(fullTrace.contains("func1"));
59 Expect.isFalse(full_trace.contains("func2")); 39 Expect.isFalse(fullTrace.contains("func2"));
60 Expect.isTrue(full_trace.contains("func3")); 40 Expect.isTrue(fullTrace.contains("func3"));
61 Expect.isTrue(full_trace.contains("func4")); 41 Expect.isTrue(fullTrace.contains("func4"));
62 Expect.isTrue(full_trace.contains("func5")); 42 Expect.isTrue(fullTrace.contains("func5"));
63 Expect.isTrue(full_trace.contains("func6")); 43 Expect.isTrue(fullTrace.contains("func6"));
64 Expect.isTrue(full_trace.contains("func7")); 44 Expect.isTrue(fullTrace.contains("func7"));
65 Expect.isTrue(full_trace.contains("main")); 45 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 } 46 }
87 return 1; 47 return 1;
88 } 48 }
89 int func6() { 49 int func6() {
90 func5(); 50 func5();
91 return 1; 51 return 1;
92 } 52 }
93 int func7() { 53 int func7() {
94 func6(); 54 func6();
95 return 1; 55 return 1;
96 } 56 }
97 main() { 57 main() {
98 var i = func7(); 58 var i = func7();
99 Expect.equals(1, i); 59 Expect.equals(1, i);
100 } 60 }
OLDNEW
« no previous file with comments | « tests/language/full_stacktrace2_test.dart ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698