debugger test could hang if run with umask 0002
[p5sagit/p5-mst-13.2.git] / lib / perl5db.t
CommitLineData
635f2c9e 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 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
30rc(
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
46runperl(switches => [ '-d' ], progfile => '../lib/perl5db/eval-line-bug');
47
48my $contents;
49{
50 local $/;
51 open I, "<", 'db.out' or die $!;
52 $contents = <I>;
53 close(I);
54}
55
56like($contents, qr/factorial/,
57 'The ${main::_<filename} variable in the debugger was not destroyed'
58);
59
60# clean up.
61
62END {
63 unlink '.perldb', 'db.out';
64}