Commit | Line | Data |
89c1e84a |
1 | #!/usr/bin/perl -w |
2 | |
33459055 |
3 | BEGIN { |
a9153838 |
4 | if( $ENV{PERL_CORE} ) { |
5 | chdir 't'; |
89c1e84a |
6 | @INC = ('../lib', 'lib'); |
7 | } |
8 | else { |
9 | unshift @INC, 't/lib'; |
a9153838 |
10 | } |
33459055 |
11 | } |
12 | |
d020a79a |
13 | use strict; |
0257f296 |
14 | use Test::More tests => 16; |
89c1e84a |
15 | use TieOut; |
d020a79a |
16 | |
17 | BEGIN { $^W = 1; } |
18 | |
19 | my $warnings = ''; |
a9153838 |
20 | local $SIG{__WARN__} = sub { $warnings .= join '', @_ }; |
d020a79a |
21 | |
22 | is( undef, undef, 'undef is undef'); |
23 | is( $warnings, '', ' no warnings' ); |
24 | |
25 | isnt( undef, 'foo', 'undef isnt foo'); |
26 | is( $warnings, '', ' no warnings' ); |
27 | |
a9153838 |
28 | isnt( undef, '', 'undef isnt an empty string' ); |
29 | isnt( undef, 0, 'undef isnt zero' ); |
30 | |
d020a79a |
31 | like( undef, '/.*/', 'undef is like anything' ); |
32 | is( $warnings, '', ' no warnings' ); |
33 | |
34 | eq_array( [undef, undef], [undef, 23] ); |
35 | is( $warnings, '', 'eq_array() no warnings' ); |
36 | |
37 | eq_hash ( { foo => undef, bar => undef }, |
38 | { foo => undef, bar => 23 } ); |
39 | is( $warnings, '', 'eq_hash() no warnings' ); |
40 | |
41 | eq_set ( [undef, undef, 12], [29, undef, undef] ); |
42 | is( $warnings, '', 'eq_set() no warnings' ); |
43 | |
44 | |
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' ); |
48 | |
49 | |
89c1e84a |
50 | my $tb = Test::More->builder; |
51 | |
52 | use TieOut; |
53 | my $caught = tie *CATCH, 'TieOut'; |
54 | my $old_fail = $tb->failure_output; |
55 | $tb->failure_output(\*CATCH); |
56 | diag(undef); |
57 | $tb->failure_output($old_fail); |
58 | |
59 | is( $caught->read, "# undef\n" ); |
60 | is( $warnings, '', 'diag(undef) no warnings' ); |
0257f296 |
61 | |
62 | |
63 | $tb->maybe_regex(undef); |
64 | is( $caught->read, '' ); |
65 | is( $warnings, '', 'maybe_regex(undef) no warnings' ); |