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

Unified Diff: tests/language/stack_trace_test.dart

Issue 23691024: If a rethrow is encountered in the catch block, then its handler must be marked that it needs stack… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« runtime/vm/intermediate_language.h ('K') | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/stack_trace_test.dart
===================================================================
--- tests/language/stack_trace_test.dart (revision 26933)
+++ tests/language/stack_trace_test.dart (working copy)
@@ -83,6 +83,63 @@
}
}
+
+// Test that the full stack trace is generated for rethrow.
+class RethrowStacktraceTest {
+ var config = 0;
+
+ a() {
+ throw "Progy";
+ }
+
+ b() {
+ a();
+ }
+
+ c() {
+ if (config == 0) {
+ try {
+ b();
+ } catch (e) {
+ rethrow;
+ }
+ } else {
+ try {
+ b();
+ } catch (e, s) {
+ rethrow;
+ }
+ }
+ }
+
+ d() {
+ c();
+ }
+
+ testBoth() {
+ int prev_len = -1;
+ for (config = 0; config < 2; config++) {
+ try {
+ d();
+ } catch (e, s) {
+ if (prev_len < 0) {
+ prev_len = s.toString().length;
+ } else {
+ // Check both stacktraces have same length.
+ Expect.equals(prev_len, s.toString().length);
Ivan Posva 2013/08/31 00:06:23 How about just checking that a() is in the stacktr
srdjan 2013/08/31 00:18:06 renamed a to issue12940 and checking for it.
+ }
+ }
+ }
+ }
+
+ static testMain() {
+ var test = new RethrowStacktraceTest();
+ test.testBoth();
+ }
+}
+
+
main() {
StackTraceTest.testMain();
+ RethrowStacktraceTest.testMain();
}
« runtime/vm/intermediate_language.h ('K') | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698