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

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

Issue 14009004: Remove methods on StackTrace class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
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 full_trace = s.toString();
kasperl 2013/04/11 09:29:48 full_trace -> fullTrace
18
19 var full_trace = s.fullStackTrace;
20 Expect.isTrue(full_trace.contains("func1")); 21 Expect.isTrue(full_trace.contains("func1"));
21 Expect.isTrue(full_trace.contains("func2")); 22 Expect.isTrue(full_trace.contains("func2"));
22 Expect.isTrue(full_trace.contains("func3")); 23 Expect.isTrue(full_trace.contains("func3"));
23 Expect.isTrue(full_trace.contains("func4")); 24 Expect.isTrue(full_trace.contains("func4"));
24 Expect.isTrue(full_trace.contains("func5")); 25 Expect.isTrue(full_trace.contains("func5"));
25 Expect.isTrue(full_trace.contains("func6")); 26 Expect.isTrue(full_trace.contains("func6"));
26 Expect.isTrue(full_trace.contains("main")); 27 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("main"));
37
38 print(s);
39
40 print("Full stack trace");
41 print(full_trace);
42
43 print("Stack trace");
44 print(trace);
45 } 28 }
46 } 29 }
47 int func4() { 30 int func4() {
48 func3(); 31 func3();
49 return 1; 32 return 1;
50 } 33 }
51 int func5() { 34 int func5() {
52 func4(); 35 func4();
53 return 1; 36 return 1;
54 } 37 }
55 int func6() { 38 int func6() {
56 func5(); 39 func5();
57 return 1; 40 return 1;
58 } 41 }
59 main() { 42 main() {
60 var i = func6(); 43 var i = func6();
61 Expect.equals(1, i); 44 Expect.equals(1, i);
62 } 45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698