This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
mktables: Add comment
[perl5.git] / lib / perl5db.t
index 95d2030..bd5615a 100644 (file)
@@ -29,7 +29,7 @@ BEGIN {
     $ENV{PERL_RL} = 'Perl'; # Suppress system Term::ReadLine::Gnu
 }
 
-plan(119);
+plan(120);
 
 my $rc_filename = '.perldb';
 
@@ -1041,13 +1041,13 @@ sub _calc_trace_wrapper
 DebugWrap->new({
     cmds =>
     [
-        'n', 'print "<$x>"',
-        'n', 'print "<$x>"',
+        'n', 'print "<$x>\n"',
+        'n', 'print "<$x>\n"',
         'q',
     ],
     prog => '../lib/perl5db/t/lsub-n',
 })->output_like(
-    qr/<1><11>/,
+    qr/<1>\n<11>\n/,
     'n steps over lvalue subs',
 );
 
@@ -1505,10 +1505,11 @@ DebugWrap->new({
         }
     );
 
+    my $nl = $^O eq 'VMS' ? "" : "\\\n";
     $wrapper->output_like(qr#
-        \nVar<Q>=1\n
-        \nVar<Q>=2\n
-        \nVar<Q>=3\n
+        \nVar<Q>=1$nl
+        \nVar<Q>=2$nl
+        \nVar<Q>=3
         #msx,
         "a command is working",
     );
@@ -2278,7 +2279,7 @@ DebugWrap->new({
     );
 
     $wrapper->output_like(qr#
-        ^This\ program\ dies\.\ at\ \S+\ line\ 18\.\n
+        ^This\ program\ dies\.\ at\ \S+\ line\ 18\N*\.\n
         .*?
         ^\s+main::baz\(\)\ called\ at\ \S+\ line\ 13\n
         \s+main::bar\(\)\ called\ at\ \S+\ line\ 7\n
@@ -2303,7 +2304,7 @@ DebugWrap->new({
     );
 
     $wrapper->contents_like(qr#
-        ^This\ is\ not\ a\ warning\.\ at\ \S+\ line\ 18\.\n
+        ^This\ is\ not\ a\ warning\.\ at\ \S+\ line\ 18\N*\.\n
         .*?
         ^\s+main::baz\(\)\ called\ at\ \S+\ line\ 13\n
         \s+main::bar\(\)\ called\ at\ \S+\ line\ 25\n
@@ -2696,6 +2697,55 @@ DebugWrap->new({
     );
 }
 
+# perl 5 RT #121509 regression bug.
+# “perl debugger doesn't save starting dir to restart from”
+# Thanks to Linda Walsh for reporting it.
+{
+    use File::Temp qw/tempdir/;
+
+    my $temp_dir = tempdir( CLEANUP => 1 );
+
+    local $ENV{__PERLDB_TEMP_DIR} = $temp_dir;
+    my $wrapper = DebugWrap->new(
+        {
+            cmds =>
+            [
+                # This is to avoid getting the "Debugger program terminated"
+                # junk that interferes with the normal output.
+                'b _after_chdir',
+                'c',
+                'R',
+                'b _finale',
+                'c',
+                'n',
+                'n',
+                'n',
+                'n',
+                'n',
+                'n',
+                'n',
+                'n',
+                'n',
+                'n',
+                'n',
+                'n',
+                'q',
+            ],
+            prog => '../lib/perl5db/t/rt-121509-restart-after-chdir',
+        }
+    );
+
+    $wrapper->output_like(
+        qr/
+In\ _finale\ No\ 1
+    .*?
+In\ _finale\ No\ 2
+    .*?
+In\ _finale\ No\ 3
+        /msx,
+        "Test that the debugger chdirs to the initial directory after a restart.",
+    );
+}
 # Test the perldoc command
 # We don't actually run the program, but we need to provide one to the wrapper.
 SKIP: