This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
An empty test.
[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';
e8c07a23
JH
6 unless (find PerlIO::Layer 'perlio') { # PerlIO::scalar
7 print "1..0 # Skip: not perlio\n";
8 exit 0;
9 }
fafebdf5
A
10}
11
12use strict;
13
14$|=1;
96b31d9e
JH
15
16my @prgs;
17{
18 local $/;
19 @prgs = split "########\n", <DATA>;
20 close DATA;
21}
22
23use Test::More;
24
25plan tests => scalar @prgs;
26
fafebdf5
A
27require "dumpvar.pl";
28
96b31d9e
JH
29for (@prgs) {
30 my($prog, $expected) = split(/\nEXPECT\n?/, $_);
fafebdf5
A
31 open my $select, ">", \my $got or die;
32 select $select;
33 eval $prog;
96b31d9e 34 my $ERR = $@;
fafebdf5
A
35 close $select;
36 select STDOUT;
96b31d9e
JH
37 if ($ERR) {
38 ok(0, "$prog - $ERR");
39 } else {
40 is($got, $expected, $prog);
41 }
fafebdf5
A
42}
43
44__END__
fafebdf5
A
45dumpValue(1);
46EXPECT
471
48########
49dumpValue("1\n2\n3");
50EXPECT
51'1
522
533'
54########
55dumpValue([1..3],1);
56EXPECT
570 1
581 2
592 3
60########
61dumpValue({1..4},1);
62EXPECT
631 => 2
643 => 4
65########