Rename ext/List/Util as ext/List-Util
[p5sagit/p5-mst-13.2.git] / ext / List-Util / t / blessed.t
1 #!./perl
2
3 BEGIN {
4     unless (-d 'blib') {
5         chdir 't' if -d 't';
6         @INC = '../lib';
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";
11             exit 0;
12         }
13     }
14 }
15
16 use Test::More tests => 8;
17 use Scalar::Util qw(blessed);
18 use vars qw($t $x);
19
20 ok(!blessed(undef),     'undef is not blessed');
21 ok(!blessed(1),         'Numbers are not blessed');
22 ok(!blessed('A'),       'Strings are not blessed');
23 ok(!blessed({}),        'Unblessed HASH-ref');
24 ok(!blessed([]),        'Unblessed ARRAY-ref');
25 ok(!blessed(\$t),       'Unblessed SCALAR-ref');
26
27 $x = bless [], "ABC";
28 is(blessed($x), "ABC",  'blessed ARRAY-ref');
29
30 $x = bless {}, "DEF";
31 is(blessed($x), "DEF",  'blessed HASH-ref');