summaryrefslogtreecommitdiff
path: root/lib/perl5db.t
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-11-14 16:59:45 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-11-14 16:59:45 +0000
commit635f2c9e92f8c492655e9f22e378ee92d3368ced (patch)
tree79adf735d2f40ae02b843b67fb088593ddf910e8 /lib/perl5db.t
parent48de12d940c558762a4819fcf31deba3b8cb6fea (diff)
downloadperl-635f2c9e92f8c492655e9f22e378ee92d3368ced.tar.gz
A first regression test for the debugger, by Shlomi Fish
and Richard Foley. p4raw-id: //depot/perl@29274
Diffstat (limited to 'lib/perl5db.t')
-rw-r--r--lib/perl5db.t61
1 files changed, 61 insertions, 0 deletions
diff --git a/lib/perl5db.t b/lib/perl5db.t
new file mode 100644
index 0000000000..8735e87a44
--- /dev/null
+++ b/lib/perl5db.t
@@ -0,0 +1,61 @@
+#!/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);
+}
+
+rc(
+ qq|
+ &parse_options("NonStop=0 TTY=/dev/null LineInfo=db.out");
+ \n|,
+
+ qq|
+ sub afterinit {
+ push(\@DB::typeahead,
+ "DB::print_lineinfo(\@{'main::_<perl5db/eval-line-bug'})",
+ 'b 23',
+ 'c',
+ 'q',
+ );
+ }\n|,
+);
+
+runperl(switches => [ '-d' ], progfile => '../lib/perl5db/eval-line-bug');
+
+my $contents;
+{
+ local $/;
+ open I, "<", 'db.out' or die $!;
+ $contents = <I>;
+ close(I);
+}
+
+like($contents, qr/factorial/,
+ 'The ${main::_<filename} variable in the debugger was not destroyed'
+);
+
+# clean up.
+
+END {
+ unlink '.perldb', 'db.out';
+}