Commit | Line | Data |
635f2c9e |
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 | } |
9366364f |
17 | if (!-c "/dev/tty") { |
18 | print "1..0 # Skip: no /dev/tty\n"; |
19 | exit 0; |
20 | } |
635f2c9e |
21 | } |
22 | |
23 | plan(1); |
24 | |
25 | sub rc { |
26 | open RC, ">", ".perldb" or die $!; |
27 | print RC @_; |
28 | close(RC); |
3e5e55bd |
29 | # overly permissive perms gives "Must not source insecure rcfile" |
30 | # and hangs at the DB(1> prompt |
31 | chmod 0644, ".perldb"; |
635f2c9e |
32 | } |
33 | |
cd4eab35 |
34 | my $target = '../lib/perl5db/t/eval-line-bug'; |
35 | |
635f2c9e |
36 | rc( |
37 | qq| |
cd4eab35 |
38 | &parse_options("NonStop=0 TTY=db.out LineInfo=db.out"); |
635f2c9e |
39 | \n|, |
40 | |
41 | qq| |
42 | sub afterinit { |
43 | push(\@DB::typeahead, |
635f2c9e |
44 | 'b 23', |
cd4eab35 |
45 | 'n', |
46 | 'n', |
47 | 'n', |
48 | 'c', # line 23 |
49 | 'n', |
50 | "p \\\@{'main::_<$target'}", |
635f2c9e |
51 | 'q', |
52 | ); |
53 | }\n|, |
54 | ); |
55 | |
cd4eab35 |
56 | runperl(switches => [ '-d' ], progfile => $target); |
635f2c9e |
57 | |
58 | my $contents; |
59 | { |
60 | local $/; |
61 | open I, "<", 'db.out' or die $!; |
62 | $contents = <I>; |
63 | close(I); |
64 | } |
65 | |
cd4eab35 |
66 | like($contents, qr/sub factorial/, |
635f2c9e |
67 | 'The ${main::_<filename} variable in the debugger was not destroyed' |
68 | ); |
69 | |
70 | # clean up. |
71 | |
72 | END { |
cd4eab35 |
73 | unlink qw(.perldb db.out); |
635f2c9e |
74 | } |