| OLD | NEW |
| 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 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 var fullTrace = s.toString(); | 17 var fullTrace = s.toString(); |
| 18 print(fullTrace); |
| 18 Expect.isTrue(fullTrace.contains("func1")); | 19 Expect.isTrue(fullTrace.contains("func1")); |
| 19 Expect.isTrue(fullTrace.contains("func2")); | 20 Expect.isTrue(fullTrace.contains("func2")); |
| 20 Expect.isTrue(fullTrace.contains("func3")); | 21 Expect.isTrue(fullTrace.contains("func3")); |
| 21 Expect.isTrue(fullTrace.contains("func4")); | 22 Expect.isTrue(fullTrace.contains("func4")); |
| 22 Expect.isTrue(fullTrace.contains("func5")); | 23 Expect.isTrue(fullTrace.contains("func5")); |
| 23 Expect.isTrue(fullTrace.contains("func6")); | 24 Expect.isTrue(fullTrace.contains("func6")); |
| 24 Expect.isTrue(fullTrace.contains("func7")); | 25 Expect.isTrue(fullTrace.contains("func7")); |
| 25 Expect.isTrue(fullTrace.contains("main")); | 26 Expect.isTrue(fullTrace.contains("main")); |
| 26 throw new Exception("This is not a rethrow"); | 27 throw new Exception("This is not a rethrow"); |
| 27 } | 28 } |
| 28 } | 29 } |
| 29 int func4() { | 30 int func4() { |
| 30 func3(); | 31 func3(); |
| 31 return 1; | 32 return 1; |
| 32 } | 33 } |
| 33 int func5() { | 34 int func5() { |
| 34 try { | 35 try { |
| 35 func4(); | 36 func4(); |
| 36 } on Object catch(e, s) { | 37 } on Object catch(e, s) { |
| 37 var fullTrace = s.toString(); | 38 var fullTrace = s.toString(); |
| 39 print(fullTrace); |
| 38 Expect.isFalse(fullTrace.contains("func1")); | 40 Expect.isFalse(fullTrace.contains("func1")); |
| 39 Expect.isFalse(fullTrace.contains("func2")); | 41 Expect.isFalse(fullTrace.contains("func2")); |
| 40 Expect.isTrue(fullTrace.contains("func3")); | 42 Expect.isTrue(fullTrace.contains("func3")); |
| 41 Expect.isTrue(fullTrace.contains("func4")); | 43 Expect.isTrue(fullTrace.contains("func4")); |
| 42 Expect.isTrue(fullTrace.contains("func5")); | 44 Expect.isTrue(fullTrace.contains("func5")); |
| 43 Expect.isTrue(fullTrace.contains("func6")); | 45 Expect.isTrue(fullTrace.contains("func6")); |
| 44 Expect.isTrue(fullTrace.contains("func7")); | 46 Expect.isTrue(fullTrace.contains("func7")); |
| 45 Expect.isTrue(fullTrace.contains("main")); | 47 Expect.isTrue(fullTrace.contains("main")); |
| 46 } | 48 } |
| 47 return 1; | 49 return 1; |
| 48 } | 50 } |
| 49 int func6() { | 51 int func6() { |
| 50 func5(); | 52 func5(); |
| 51 return 1; | 53 return 1; |
| 52 } | 54 } |
| 53 int func7() { | 55 int func7() { |
| 54 func6(); | 56 func6(); |
| 55 return 1; | 57 return 1; |
| 56 } | 58 } |
| 57 main() { | 59 main() { |
| 58 var i = func7(); | 60 var i = func7(); |
| 59 Expect.equals(1, i); | 61 Expect.equals(1, i); |
| 60 } | 62 } |
| OLD | NEW |