Commit | Line | Data |
---|---|---|
635f2c9e RGS |
1 | #!/usr/bin/perl |
2 | ||
3 | BEGIN { | |
4 | chdir 't' if -d 't'; | |
5 | @INC = '../lib'; | |
6 | require './test.pl'; | |
7 | } | |
8 | ||
9 | use strict; | |
10 | use warnings; | |
11 | ||
12 | BEGIN { | |
13 | if (!-c "/dev/null") { | |
14 | print "1..0 # Skip: no /dev/null\n"; | |
15 | exit 0; | |
16 | } | |
17 | } | |
18 | ||
19 | plan(1); | |
20 | ||
21 | sub 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 |
30 | my $target = '../lib/perl5db/t/eval-line-bug'; |
31 | ||
635f2c9e RGS |
32 | rc( |
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 | 52 | runperl(switches => [ '-d' ], progfile => $target); |
635f2c9e RGS |
53 | |
54 | my $contents; | |
55 | { | |
56 | local $/; | |
57 | open I, "<", 'db.out' or die $!; | |
58 | $contents = <I>; | |
59 | close(I); | |
60 | } | |
61 | ||
cd4eab35 | 62 | like($contents, qr/sub factorial/, |
635f2c9e RGS |
63 | 'The ${main::_<filename} variable in the debugger was not destroyed' |
64 | ); | |
65 | ||
66 | # clean up. | |
67 | ||
68 | END { | |
cd4eab35 | 69 | unlink qw(.perldb db.out); |
635f2c9e | 70 | } |