7 require Config; import Config;
8 keys %Config; # Silence warning
9 if ($Config{extensions} !~ /\bList\/Util\b/) {
10 print "1..0 # Skip: List::Util was not built\n";
16 use Test::More tests => 29;
18 use Scalar::Util qw(reftype);
19 use vars qw($t $y $x *F);
20 use Symbol qw(gensym);
22 # Ensure we do not trigger and tied methods
24 my $RE = $] < 5.011 ? 'SCALAR' : 'REGEXP';
27 [ undef, 1, 'number' ],
28 [ undef, 'A', 'string' ],
29 [ HASH => {}, 'HASH ref' ],
30 [ ARRAY => [], 'ARRAY ref' ],
31 [ SCALAR => \$t, 'SCALAR ref' ],
32 [ REF => \(\$t), 'REF ref' ],
33 [ GLOB => \*F, 'tied GLOB ref' ],
34 [ GLOB => gensym, 'GLOB ref' ],
35 [ CODE => sub {}, 'CODE ref' ],
36 [ IO => *STDIN{IO},'IO ref' ],
37 [ $RE => qr/x/, 'REGEEXP' ],
40 foreach $test (@test) {
41 my($type,$what, $n) = @$test;
43 is( reftype($what), $type, $n);
44 next unless ref($what);
47 is( reftype($what), $type, $n);
50 is( reftype($what), $type, $n);
55 sub TIEHANDLE { bless {} }
59 warn "$AUTOLOAD called";
60 exit 1; # May be in an eval