6 # I would like more tests, but contents change over every perl version
7 use Test
::More tests
=> 6;
12 $Data::Peek
::has_perlio
= $Data::Peek
::has_perlio
= 0;
14 ok
(1, "DDump () NOT using PerlIO");
18 chomp (@tests = <DATA
>);
21 # Determine what newlines this perl generates in sv_peek
26 foreach my $test (@tests) {
27 my ($in, $expect) = split m/\n--\n/ => $test;
31 my $dump = DDump
($var);
35 skip
"No UTF8 in ancient perl", 1;
38 @nl = ($dump =~ m/PV = 0x\w+ "([^"]+)".*"([^"]+)"/);
39 diag
"# This perl dumps \\n as (@nl)";
40 # Catch differences in \n
41 $dump =~ s/"ab\Q$nl[0]\E(.*?)"ab\Q$nl[1]\E/"ab\\n$1"ab\\n/g;
45 $dump =~ s/\b0x[0-9a-f]+\b/0x****/g;
46 $dump =~ s/\b(REFCNT =) [0-9]{4,}/$1 -1/g;
48 $dump =~ s/\bLEN = (?:[1-9]|1[0-6])\b/LEN = 8/g; # aligned at long long?
50 $dump =~ s/\bPADBUSY\b,?//g if $] < 5.010;
52 $dump =~ s/\bUV = /IV = /g if $] < 5.008;
53 $dump =~ s/,?\bIsUV\b//g if $] < 5.008;
55 my @expect = split m/(?<=\n)\|\n+/ => $expect;
59 my @match = grep { $dump eq $_ } @expect;
61 is
($dump, $match[0], "DDump ($in)");
64 my $match = shift @expect;
65 is
($dump, $match, "DDump ($in)");
66 diag
("DDump ($in) neither matches\n$_") for @expect;
76 SV
= PV
(0x
****) at
0x
****
83 SV
= PV
(0x
****) at
0x
****
90 SV
= PVIV
(0x
****) at
0x
****
92 FLAGS
= (PADMY
,IOK
,pIOK
)
98 SV
= PVIV
(0x
****) at
0x
****
100 FLAGS
= (PADMY
,IOK
,pIOK
)
106 SV
= PVIV
(0x
****) at
0x
****
108 FLAGS
= (PADMY
,IOK
,pIOK
)
114 SV
= PVIV
(0x
****) at
0x
****
116 FLAGS
= (PADMY
,IOK
,pIOK
)
122 SV
= PVIV
(0x
****) at
0x
****
124 FLAGS
= (PADMY
,POK
,pPOK
)
130 SV
= PVIV
(0x
****) at
0x
****
132 FLAGS
= (PADMY
,POK
,IsCOW
,pPOK
)