4 if( $ENV{PERL_CORE} ) {
6 @INC = ('../lib', 'lib');
14 use Test::More tests => 21;
19 local $SIG{__WARN__} = sub { $warnings .= join '', @_ };
21 my $TB = Test::Builder->new;
23 $TB->is_eq($warnings, '', ' no warnings');
28 $TB->is_eq($warnings, $_[0]);
33 $TB->like($warnings, $_[0]);
38 my $Filename = quotemeta $0;
41 is( undef, undef, 'undef is undef');
44 isnt( undef, 'foo', 'undef isnt foo');
47 isnt( undef, '', 'undef isnt an empty string' );
48 isnt( undef, 0, 'undef isnt zero' );
50 Test::More->builder->is_num(undef, undef, 'is_num()');
51 Test::More->builder->isnt_num(23, undef, 'isnt_num()');
54 like( undef, qr/.*/, 'undef is like anything' );
57 eq_array( [undef, undef], [undef, 23] );
60 eq_hash ( { foo => undef, bar => undef },
61 { foo => undef, bar => 23 } );
64 eq_set ( [undef, undef, 12], [29, undef, undef] );
68 eq_hash ( { foo => undef, bar => { baz => undef, moo => 23 } },
69 { foo => undef, bar => { baz => undef, moo => 23 } } );
74 cmp_ok( undef, '<=', 2, ' undef <= 2' );
75 warnings_like(qr/Use of uninitialized value.* at \(eval in cmp_ok\) $Filename line 74\.\n/);
79 my $tb = Test::More->builder;
82 $tb->failure_output(\$err);
86 is( $err, "# undef\n" );
90 $tb->maybe_regex(undef);
94 # test-more.googlecode.com #42
96 is_deeply([ undef ], [ undef ]);