4 if( $ENV{PERL_CORE} ) {
6 @INC = ('../lib', 'lib');
18 if( eval "warnings->can('carp')" ) {
19 plan skip_all => 'Modern::Open is installed, which breaks this test';
26 local $SIG{__WARN__} = sub { $warnings .= join '', @_ };
28 my $TB = Test::Builder->new;
30 $TB->is_eq($warnings, '', ' no warnings');
35 $TB->is_eq($warnings, $_[0]);
40 $TB->like($warnings, $_[0]);
45 my $Filename = quotemeta $0;
48 is( undef, undef, 'undef is undef');
51 isnt( undef, 'foo', 'undef isnt foo');
54 isnt( undef, '', 'undef isnt an empty string' );
55 isnt( undef, 0, 'undef isnt zero' );
57 Test::More->builder->is_num(undef, undef, 'is_num()');
58 Test::More->builder->isnt_num(23, undef, 'isnt_num()');
61 like( undef, qr/.*/, 'undef is like anything' );
64 eq_array( [undef, undef], [undef, 23] );
67 eq_hash ( { foo => undef, bar => undef },
68 { foo => undef, bar => 23 } );
71 eq_set ( [undef, undef, 12], [29, undef, undef] );
75 eq_hash ( { foo => undef, bar => { baz => undef, moo => 23 } },
76 { foo => undef, bar => { baz => undef, moo => 23 } } );
81 cmp_ok( undef, '<=', 2, ' undef <= 2' );
82 warnings_like(qr/Use of uninitialized value.* at \(eval in cmp_ok\) $Filename line 74\.\n/);
86 my $tb = Test::More->builder;
89 $tb->failure_output(\$err);
93 is( $err, "# undef\n" );
97 $tb->maybe_regex(undef);
101 # test-more.googlecode.com #42
103 is_deeply([ undef ], [ undef ]);