This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Test skeleton for debugger commands
[perl5.git] / lib / perl5db / dumpvar.t
CommitLineData
fafebdf5
A
1#!./perl -- -*- mode: cperl; cperl-indent-level: 4 -*-
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6}
7
8use strict;
9
10$|=1;
11undef $/;
12my @prgs = split "########\n", <DATA>;
13close DATA;
14print "1..", scalar @prgs, "\n";
15require "dumpvar.pl";
16
17my $i = 0;
18for (@prgs){
19 my($prog,$expected) = split(/\nEXPECT\n?/, $_);
20 open my $select, ">", \my $got or die;
21 select $select;
22 eval $prog;
23 my $not = "";
24 my $why = "";
25 if ($@) {
26 $not = "not ";
27 $why = " # prog[$prog]\$\@[$@]";
28 } elsif ($got ne $expected) {
29 $not = "not ";
30 $why = " # prog[$prog]got[$got]expected[$expected]";
31 }
32 close $select;
33 select STDOUT;
34 print $not, "ok ", ++$i, $why, "\n";
35}
36
37__END__
38"";
39EXPECT
40########
41dumpValue(1);
42EXPECT
431
44########
45dumpValue("1\n2\n3");
46EXPECT
47'1
482
493'
50########
51dumpValue([1..3],1);
52EXPECT
530 1
541 2
552 3
56########
57dumpValue({1..4},1);
58EXPECT
591 => 2
603 => 4
61########