Some escapes were mentioned twice, although they're not qr//-specific
[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 }
9366364f 17 if (!-c "/dev/tty") {
18 print "1..0 # Skip: no /dev/tty\n";
19 exit 0;
20 }
635f2c9e 21}
22
23plan(1);
24
25sub 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 34my $target = '../lib/perl5db/t/eval-line-bug';
35
635f2c9e 36rc(
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 56runperl(switches => [ '-d' ], progfile => $target);
635f2c9e 57
58my $contents;
59{
60 local $/;
61 open I, "<", 'db.out' or die $!;
62 $contents = <I>;
63 close(I);
64}
65
cd4eab35 66like($contents, qr/sub factorial/,
635f2c9e 67 'The ${main::_<filename} variable in the debugger was not destroyed'
68);
69
70# clean up.
71
72END {
cd4eab35 73 unlink qw(.perldb db.out);
635f2c9e 74}