Add a testcase for the bug.
authorShlomi Fish <shlomif@shlomifish.org>
Thu, 15 Nov 2012 15:54:26 +0000 (17:54 +0200)
committerTony Cook <tony@develop-help.com>
Wed, 2 Jan 2013 00:22:04 +0000 (11:22 +1100)
It is caused by $obj spontaneously becoming undef for no good reason -
seems like a bug in the perl interpreter (or elsewhere). This was
noticed by Father C here:

https://rt.perl.org/rt3/Ticket/Display.html?id=114926

lib/perl5db.t

index b021ffe..e2efa25 100644 (file)
@@ -798,6 +798,30 @@ sub _calc_trace_wrapper
     );
 }
 
+# Tests for x with AutoTrace=1.
+{
+    my $wrapper = DebugWrap->new(
+        {
+            cmds =>
+            [
+                'n',
+                'o AutoTrace=1',
+                # So it may fail.
+                q/x "failure"/,
+                q/x \$x/,
+                'q',
+            ],
+            prog => '../lib/perl5db/t/with-subroutine',
+        }
+    );
+
+    $wrapper->contents_like(
+        # qr/^0\s+HASH\([^\)]+\)\n\s+500 => 600\n/,
+        qr/^0\sSCALAR\([^\)]+\)\n\s+-> 'hello world'\n/ms,
+        "x after AutoTrace=1 command is working."
+    );
+}
+
 # Tests for "T" (stack trace).
 {
     my $prog_fn = '../lib/perl5db/t/rt-104168';