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