This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #41587] [PATCH] 5.8.8 make sure we get the proper ldflags on libperl.so
[perl5.git] / lib / perl5db.t
CommitLineData
635f2c9e
RGS
1#!/usr/bin/perl
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6 require './test.pl';
7}
8
9use strict;
10use warnings;
11
12BEGIN {
13 if (!-c "/dev/null") {
14 print "1..0 # Skip: no /dev/null\n";
15 exit 0;
16 }
17}
18
19plan(1);
20
21sub rc {
22 open RC, ">", ".perldb" or die $!;
23 print RC @_;
24 close(RC);
3e5e55bd
DM
25 # overly permissive perms gives "Must not source insecure rcfile"
26 # and hangs at the DB(1> prompt
27 chmod 0644, ".perldb";
635f2c9e
RGS
28}
29
cd4eab35
RGS
30my $target = '../lib/perl5db/t/eval-line-bug';
31
635f2c9e
RGS
32rc(
33 qq|
cd4eab35 34 &parse_options("NonStop=0 TTY=db.out LineInfo=db.out");
635f2c9e
RGS
35 \n|,
36
37 qq|
38 sub afterinit {
39 push(\@DB::typeahead,
635f2c9e 40 'b 23',
cd4eab35
RGS
41 'n',
42 'n',
43 'n',
44 'c', # line 23
45 'n',
46 "p \\\@{'main::_<$target'}",
635f2c9e
RGS
47 'q',
48 );
49 }\n|,
50);
51
cd4eab35 52runperl(switches => [ '-d' ], progfile => $target);
635f2c9e
RGS
53
54my $contents;
55{
56 local $/;
57 open I, "<", 'db.out' or die $!;
58 $contents = <I>;
59 close(I);
60}
61
cd4eab35 62like($contents, qr/sub factorial/,
635f2c9e
RGS
63 'The ${main::_<filename} variable in the debugger was not destroyed'
64);
65
66# clean up.
67
68END {
cd4eab35 69 unlink qw(.perldb db.out);
635f2c9e 70}