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)\|(?:\s*#.*)?\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
****
88 SV
= PV
(0x
****) at
0x
****
95 SV
= PVIV
(0x
****) at
0x
****
97 FLAGS
= (PADMY
,IOK
,pIOK
)
103 SV
= PVIV
(0x
****) at
0x
****
105 FLAGS
= (PADMY
,IOK
,pIOK
)
109 SV
= PVIV
(0x
****) at
0x
****
117 SV
= PVIV
(0x
****) at
0x
****
119 FLAGS
= (PADMY
,IOK
,pIOK
)
125 SV
= PVIV
(0x
****) at
0x
****
127 FLAGS
= (PADMY
,IOK
,pIOK
)
131 SV
= PVIV
(0x
****) at
0x
****
139 SV
= PVIV
(0x
****) at
0x
****
141 FLAGS
= (PADMY
,POK
,pPOK
)
147 SV
= PVIV
(0x
****) at
0x
****
149 FLAGS
= (PADMY
,POK
,IsCOW
,pPOK
)
156 SV
= PVIV
(0x
****) at
0x
****
158 FLAGS
= (POK
,IsCOW
,pPOK
)