Test::Simple/More/Builder/Tutorial 0.41
[p5sagit/p5-mst-13.2.git] / lib / Test / Simple / t / undef.t
1 BEGIN {
2     if( $ENV{PERL_CORE} ) {
3         chdir 't';
4         @INC = '../lib';
5     }
6 }
7
8 use strict;
9 use Test::More tests => 12;
10
11 BEGIN { $^W = 1; }
12
13 my $warnings = '';
14 local $SIG{__WARN__} = sub { $warnings .= join '', @_ };
15
16 is( undef, undef,           'undef is undef');
17 is( $warnings, '',          '  no warnings' );
18
19 isnt( undef, 'foo',         'undef isnt foo');
20 is( $warnings, '',          '  no warnings' );
21
22 isnt( undef, '',            'undef isnt an empty string' );
23 isnt( undef, 0,             'undef isnt zero' );
24
25 like( undef, '/.*/',        'undef is like anything' );
26 is( $warnings, '',          '  no warnings' );
27
28 eq_array( [undef, undef], [undef, 23] );
29 is( $warnings, '',          'eq_array()  no warnings' );
30
31 eq_hash ( { foo => undef, bar => undef },
32           { foo => undef, bar => 23 } );
33 is( $warnings, '',          'eq_hash()   no warnings' );
34
35 eq_set  ( [undef, undef, 12], [29, undef, undef] );
36 is( $warnings, '',          'eq_set()    no warnings' );
37
38
39 eq_hash ( { foo => undef, bar => { baz => undef, moo => 23 } },
40           { foo => undef, bar => { baz => undef, moo => 23 } } );
41 is( $warnings, '',          'eq_hash()   no warnings' );
42
43