Update to Scalar-List-Utils-1.15
[p5sagit/p5-mst-13.2.git] / ext / List / Util / t / blessed.t
CommitLineData
1bfb5477 1#!./perl
2
f4a2945e 3BEGIN {
1bfb5477 4 unless (-d 'blib') {
f4a2945e 5 chdir 't' if -d 't';
6 @INC = '../lib';
6b05f64e 7 require Config; import Config;
1bfb5477 8 keys %Config; # Silence warning
6b05f64e 9 if ($Config{extensions} !~ /\bList\/Util\b/) {
10 print "1..0 # Skip: List::Util was not built\n";
11 exit 0;
12 }
1bfb5477 13 }
f4a2945e 14}
15
cf083cf9 16use Test::More tests => 8;
f4a2945e 17use Scalar::Util qw(blessed);
cf083cf9 18use vars qw($t $x);
f4a2945e 19
cf083cf9 20ok(!blessed(undef), 'undef is not blessed');
21ok(!blessed(1), 'Numbers are not blessed');
22ok(!blessed('A'), 'Strings are not blessed');
23ok(!blessed({}), 'Unblessed HASH-ref');
24ok(!blessed([]), 'Unblessed ARRAY-ref');
25ok(!blessed(\$t), 'Unblessed SCALAR-ref');
f4a2945e 26
27$x = bless [], "ABC";
cf083cf9 28is(blessed($x), "ABC", 'blessed ARRAY-ref');
f4a2945e 29
cf083cf9 30$x = bless {}, "DEF";
31is(blessed($x), "DEF", 'blessed HASH-ref');