reftype.t (perl-5.32.0-RC0.tar.xz) | : | reftype.t (perl-5.32.0-RC1.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 21 | skipping to change at line 21 | |||
# Ensure we do not trigger and tied methods | # Ensure we do not trigger and tied methods | |||
tie *F, 'MyTie'; | tie *F, 'MyTie'; | |||
my $RE = $] < 5.011 ? 'SCALAR' : 'REGEXP'; | my $RE = $] < 5.011 ? 'SCALAR' : 'REGEXP'; | |||
my $s = []; # SvTYPE($s) is SVt_RV, and SvROK($s) is true | my $s = []; # SvTYPE($s) is SVt_RV, and SvROK($s) is true | |||
$s = undef; # SvTYPE($s) is SVt_RV, but SvROK($s) is false | $s = undef; # SvTYPE($s) is SVt_RV, but SvROK($s) is false | |||
my $t; | my $t; | |||
my @test = ( | my @test = ( | |||
[ undef, 1, 'number' ], | [ undef, 1, 'number' ], | |||
[ undef, 'A', 'string' ], | [ undef, 'A', 'string' ], | |||
[ HASH => {}, 'HASH ref' ], | [ HASH => {}, 'HASH ref' ], | |||
[ ARRAY => [], 'ARRAY ref' ], | [ ARRAY => [], 'ARRAY ref' ], | |||
[ SCALAR => \$t, 'SCALAR ref' ], | [ SCALAR => \$t, 'SCALAR ref' ], | |||
[ SCALAR => \$s, 'SCALAR ref (but SVt_RV)' ], | [ SCALAR => \$s, 'SCALAR ref (but SVt_RV)' ], | |||
[ REF => \(\$t), 'REF ref' ], | [ REF => \(\$t), 'REF ref' ], | |||
[ GLOB => \*F, 'tied GLOB ref' ], | [ GLOB => \*F, 'tied GLOB ref' ], | |||
[ GLOB => gensym, 'GLOB ref' ], | [ GLOB => gensym, 'GLOB ref' ], | |||
[ CODE => sub {}, 'CODE ref' ], | [ CODE => sub {}, 'CODE ref' ], | |||
[ IO => *STDIN{IO},'IO ref' ], | [ IO => *STDIN{IO}, 'IO ref' ], | |||
[ $RE => qr/x/, 'REGEEXP' ], | [ $RE => qr/x/, 'REGEEXP' ], | |||
); | ); | |||
foreach my $test (@test) { | foreach my $test (@test) { | |||
my($type,$what, $n) = @$test; | my($type,$what, $n) = @$test; | |||
is( reftype($what), $type, $n); | is( reftype($what), $type, $n); | |||
next unless ref($what); | next unless ref($what); | |||
bless $what, "ABC"; | bless $what, "ABC"; | |||
is( reftype($what), $type, $n); | is( reftype($what), $type, $n); | |||
End of changes. 1 change blocks. | ||||
12 lines changed or deleted | 12 lines changed or added |