File: undef.t

package info (click to toggle)
libtest-simple-perl 0.41-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 304 kB
  • ctags: 85
  • sloc: perl: 1,428; makefile: 33
file content (36 lines) | stat: -rw-r--r-- 1,082 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use strict;
use Test::More tests => 12;

BEGIN { $^W = 1; }

my $warnings = '';
local $SIG{__WARN__} = sub { $warnings .= join '', @_ };

is( undef, undef,           'undef is undef');
is( $warnings, '',          '  no warnings' );

isnt( undef, 'foo',         'undef isnt foo');
is( $warnings, '',          '  no warnings' );

isnt( undef, '',            'undef isnt an empty string' );
isnt( undef, 0,             'undef isnt zero' );

like( undef, '/.*/',        'undef is like anything' );
is( $warnings, '',          '  no warnings' );

eq_array( [undef, undef], [undef, 23] );
is( $warnings, '',          'eq_array()  no warnings' );

eq_hash ( { foo => undef, bar => undef },
          { foo => undef, bar => 23 } );
is( $warnings, '',          'eq_hash()   no warnings' );

eq_set  ( [undef, undef, 12], [29, undef, undef] );
is( $warnings, '',          'eq_set()    no warnings' );


eq_hash ( { foo => undef, bar => { baz => undef, moo => 23 } },
          { foo => undef, bar => { baz => undef, moo => 23 } } );
is( $warnings, '',          'eq_hash()   no warnings' );