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