This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
A first regression test for the debugger, by Shlomi Fish
[perl5.git] / lib / perl5db.t
CommitLineData
635f2c9e
RGS
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);
25}
26
27rc(
28 qq|
29 &parse_options("NonStop=0 TTY=/dev/null LineInfo=db.out");
30 \n|,
31
32 qq|
33 sub afterinit {
34 push(\@DB::typeahead,
35 "DB::print_lineinfo(\@{'main::_<perl5db/eval-line-bug'})",
36 'b 23',
37 'c',
38 'q',
39 );
40 }\n|,
41);
42
43runperl(switches => [ '-d' ], progfile => '../lib/perl5db/eval-line-bug');
44
45my $contents;
46{
47 local $/;
48 open I, "<", 'db.out' or die $!;
49 $contents = <I>;
50 close(I);
51}
52
53like($contents, qr/factorial/,
54 'The ${main::_<filename} variable in the debugger was not destroyed'
55);
56
57# clean up.
58
59END {
60 unlink '.perldb', 'db.out';
61}