6 use Test
::More tests
=> 50;
15 $peek =~ m/^Your perl did not/ and skip
($peek, 49);
17 like
(DPeek
($/), qr'^PVMG\("\\(n|12)"\\0\)', '$/');
18 is (DPeek ($\), 'PVMG
()', '$\\');
19 is (DPeek ($.), 'PVMG
()', '$.');
20 like (DPeek ($,), qr'^PVMG\
((""\\0)?\
)|^UNDEF
$','$,');
21 is (DPeek ($;), 'PV
("\34"\
0)', '$;');
22 is (DPeek ($"), 'PV
(" "\
0)', '$"');
23 like (DPeek ($:), qr'^PVMG\(" \\(n
|12)-"\\0\)', '$:');
24 is (DPeek ($~), 'PVMG()', '$~');
25 is (DPeek ($^), 'PVMG()', '$^');
26 is (DPeek ($=), 'PVMG()', '$=');
27 is (DPeek ($-), 'PVMG()', '$-');
28 is (DPeek ($|), 'PVMG(1)', '$|');
29 like (DPeek ($?), qr'^PV(MG|LV)\(\)', '$?');
30 like (DPeek ($!), qr'^PVMG\("', '$!');
32 "abc" =~ m/(b)/; # Don't know why these magic vars have this content
33 like
(DPeek
($1), qr
'^PVMG\("', ' $1');
34 is
(DPeek
($`), 'PVMG()', ' $`');
35 is (DPeek ($&), 'PVMG
()', ' $&');
36 is (DPeek ($'), 'PVMG()', " \$'");
38 is
(DPeek
(undef), 'SV_UNDEF', 'undef');
39 is
(DPeek
(1), 'IV(1)', 'constant 1');
40 is
(DPeek
(""), 'PV(""\0)', 'constant ""');
41 is
(DPeek
(1.), 'NV(1)', 'constant 1.');
42 is
(DPeek
(\
1), '\IV(1)', 'constant \1');
43 is
(DPeek
(\\1), '\\\IV(1)', 'constant \\\1');
45 is
(DPeek
(\
@ARGV), '\AV()', '\@ARGV');
46 is
(DPeek
(\
@INC), '\AV()', '\@INC');
47 is
(DPeek
(\
%INC), '\HV()', '\%INC');
48 is
(DPeek
(*STDOUT
), 'GV()', '*STDOUT');
49 is
(DPeek
(sub {}), '\CV(__ANON__)', 'sub {}');
51 { our ($VAR, @VAR, %VAR);
56 END { unlink "VAR.txt" };
58 is
(DPeek
( $VAR), 'UNDEF', ' $VAR undef');
59 is
(DPeek
(\
$VAR), '\UNDEF', '\$VAR undef');
61 is
(DPeek
($VAR), 'IV(1)', ' $VAR 1');
62 is
(DPeek
(\
$VAR), '\IV(1)', '\$VAR 1');
64 is
(DPeek
($VAR), 'PVIV(""\0)', ' $VAR ""');
65 is
(DPeek
(\
$VAR), '\PVIV(""\0)', '\$VAR ""');
67 is
(DPeek
($VAR), 'PVIV("\250"\0)', ' $VAR "\xa8"');
68 is
(DPeek
(\
$VAR), '\PVIV("\250"\0)', '\$VAR "\xa8"');
70 $] <= 5.008001 and skip
"UTF8 tests useless in this ancient perl version", 1;
71 $VAR = "a\x0a\x{20ac}";
72 like
(DPeek
($VAR), qr
'^PVIV\("a\\(n|12)\\342\\202\\254"\\0\) \[UTF8 "a\\?n\\x\{20ac}"\]',
73 ' $VAR "a\x0a\x{20ac}"');
76 is
(DPeek
($VAR), '\CV(__ANON__)', ' $VAR sub { "VAR" }');
77 is
(DPeek
(\
$VAR), '\\\CV(__ANON__)', '\$VAR sub { "VAR" }');
80 is
(DPeek
(\
&VAR
), '\CV(VAR)', '\&VAR');
81 is
(DPeek
( *VAR
), 'GV()', ' *VAR');
83 is
(DPeek
(*VAR
{GLOB
}), '\GV()', ' *VAR{GLOB}');
84 like
(DPeek
(*VAR
{SCALAR
}), qr
'\\PV(IV|MG)\(0\)',' *VAR{SCALAR}');
85 is
(DPeek
(*VAR
{ARRAY
}), '\AV()', ' *VAR{ARRAY}');
86 is
(DPeek
(*VAR
{HASH
}), '\HV()', ' *VAR{HASH}');
87 is
(DPeek
(*VAR
{CODE
}), '\CV(VAR)', ' *VAR{CODE}');
88 is
(DPeek
(*VAR
{IO
}), '\IO()', ' *VAR{IO}');
89 is
(DPeek
(*VAR
{FORMAT
}),$]<5.008?
'SV_UNDEF':'\FM()',' *VAR{FORMAT}');