Change 30270 by [EMAIL PROTECTED] on 2007/02/13 22:52:13
Integrate:
[ 29274]
A first regression test for the debugger, by Shlomi Fish
and Richard Foley.
[ 29275]
debugger test could hang if run with umask 0002
[ 29278]
Move the test files for the debugger in a t/ subdirectory, so they
don't get installed
[ 29280]
Tweaks to the debugger test by Richard Foley,
plus fix auxiliary file path
Affected files ...
... //depot/maint-5.8/perl/MANIFEST#325 integrate
... //depot/maint-5.8/perl/lib/perl5db.t#1 branch
... //depot/maint-5.8/perl/lib/perl5db/t/eval-line-bug#1 branch
Differences ...
==== //depot/maint-5.8/perl/MANIFEST#325 (text) ====
Index: perl/MANIFEST
--- perl/MANIFEST#324~30262~ 2007-02-13 10:05:20.000000000 -0800
+++ perl/MANIFEST 2007-02-13 14:52:13.000000000 -0800
@@ -1788,6 +1788,8 @@
lib/overload.pm Module for overloading perl operators
lib/overload.t See if operator overloading works
lib/perl5db.pl Perl debugging routines
+lib/perl5db.t Tests for the Perl debugger
+lib/perl5db/t/eval-line-bug Tests for the Perl debugger
lib/PerlIO.pm PerlIO support module
lib/PerlIO/via/QuotedPrint.pm PerlIO::via::QuotedPrint
lib/PerlIO/via/t/QuotedPrint.t PerlIO::via::QuotedPrint
==== //depot/maint-5.8/perl/lib/perl5db.t#1 (text) ====
Index: perl/lib/perl5db.t
--- /dev/null 2007-01-16 11:55:45.526841103 -0800
+++ perl/lib/perl5db.t 2007-02-13 14:52:13.000000000 -0800
@@ -0,0 +1,70 @@
+#!/usr/bin/perl
+
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ require './test.pl';
+}
+
+use strict;
+use warnings;
+
+BEGIN {
+ if (!-c "/dev/null") {
+ print "1..0 # Skip: no /dev/null\n";
+ exit 0;
+ }
+}
+
+plan(1);
+
+sub rc {
+ open RC, ">", ".perldb" or die $!;
+ print RC @_;
+ close(RC);
+ # overly permissive perms gives "Must not source insecure rcfile"
+ # and hangs at the DB(1> prompt
+ chmod 0644, ".perldb";
+}
+
+my $target = '../lib/perl5db/t/eval-line-bug';
+
+rc(
+ qq|
+ &parse_options("NonStop=0 TTY=db.out LineInfo=db.out");
+ \n|,
+
+ qq|
+ sub afterinit {
+ push([EMAIL PROTECTED]::typeahead,
+ 'b 23',
+ 'n',
+ 'n',
+ 'n',
+ 'c', # line 23
+ 'n',
+ "p [EMAIL PROTECTED]'main::_<$target'}",
+ 'q',
+ );
+ }\n|,
+);
+
+runperl(switches => [ '-d' ], progfile => $target);
+
+my $contents;
+{
+ local $/;
+ open I, "<", 'db.out' or die $!;
+ $contents = <I>;
+ close(I);
+}
+
+like($contents, qr/sub factorial/,
+ 'The ${main::_<filename} variable in the debugger was not destroyed'
+);
+
+# clean up.
+
+END {
+ unlink qw(.perldb db.out);
+}
==== //depot/maint-5.8/perl/lib/perl5db/t/eval-line-bug#1 (text) ====
Index: perl/lib/perl5db/t/eval-line-bug
--- /dev/null 2007-01-16 11:55:45.526841103 -0800
+++ perl/lib/perl5db/t/eval-line-bug 2007-02-13 14:52:13.000000000 -0800
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+#
+# This code is used by lib/perl5db.t !!!
+#
+
+my $i = 5;
+eval "
+#line 5 script.pl
+\$i = 10;
+";
+
+for my $q (1 .. 10) {
+ $i += $q;
+}
+
+sub factorial
+{
+ my $i = shift;
+ return +($i < 2) ? 1 : $i*factorial($i-1);
+}
+
+my $j = 4;
+$j = factorial($j);
+$j = factorial(10);
End of Patch.