4 if( $ENV{PERL_CORE} ) {
6 @INC = ('../lib', 'lib');
14 use Test::More tests => 16;
20 local $SIG{__WARN__} = sub { $warnings .= join '', @_ };
22 is( undef, undef, 'undef is undef');
23 is( $warnings, '', ' no warnings' );
25 isnt( undef, 'foo', 'undef isnt foo');
26 is( $warnings, '', ' no warnings' );
28 isnt( undef, '', 'undef isnt an empty string' );
29 isnt( undef, 0, 'undef isnt zero' );
31 like( undef, '/.*/', 'undef is like anything' );
32 is( $warnings, '', ' no warnings' );
34 eq_array( [undef, undef], [undef, 23] );
35 is( $warnings, '', 'eq_array() no warnings' );
37 eq_hash ( { foo => undef, bar => undef },
38 { foo => undef, bar => 23 } );
39 is( $warnings, '', 'eq_hash() no warnings' );
41 eq_set ( [undef, undef, 12], [29, undef, undef] );
42 is( $warnings, '', 'eq_set() no warnings' );
45 eq_hash ( { foo => undef, bar => { baz => undef, moo => 23 } },
46 { foo => undef, bar => { baz => undef, moo => 23 } } );
47 is( $warnings, '', 'eq_hash() no warnings' );
50 my $tb = Test::More->builder;
53 my $caught = tie *CATCH, 'TieOut';
54 my $old_fail = $tb->failure_output;
55 $tb->failure_output(\*CATCH);
57 $tb->failure_output($old_fail);
59 is( $caught->read, "# undef\n" );
60 is( $warnings, '', 'diag(undef) no warnings' );
63 $tb->maybe_regex(undef);
64 is( $caught->read, '' );
65 is( $warnings, '', 'maybe_regex(undef) no warnings' );