Lines 6-28
use Test::More tests => 19;
Link Here
|
6 |
|
6 |
|
7 |
BEGIN { use_ok( 'C4::Boolean', qw( true_p ) ); } |
7 |
BEGIN { use_ok( 'C4::Boolean', qw( true_p ) ); } |
8 |
|
8 |
|
9 |
is( true_p('0'), '0', 'recognizes \'0\' as false' ); |
9 |
is( true_p('0') , '0' , 'recognizes \'0\' as false' ); |
10 |
is( true_p('nil'), '0', 'recognizes \'nil\' as false' ); |
10 |
is( true_p('nil') , '0' , 'recognizes \'nil\' as false' ); |
11 |
is( true_p('false'), '0', 'recognizes \'false\' as false' ); |
11 |
is( true_p('false'), '0' , 'recognizes \'false\' as false' ); |
12 |
is( true_p('off'), '0', 'recognizes \'off\' as false' ); |
12 |
is( true_p('off') , '0' , 'recognizes \'off\' as false' ); |
13 |
is( true_p('no'), '0', 'recognizes \'no\' as false' ); |
13 |
is( true_p('no') , '0' , 'recognizes \'no\' as false' ); |
14 |
is( true_p('n'), '0', 'recognizes \'n\' as false' ); |
14 |
is( true_p('n') , '0' , 'recognizes \'n\' as false' ); |
15 |
is( true_p('NO'), '0', 'verified case insensitivity' ); |
15 |
is( true_p('NO') , '0' , 'verified case insensitivity' ); |
16 |
|
16 |
|
17 |
is( true_p('1'), '1', 'recognizes \'1\' as true' ); |
17 |
is( true_p('1') , '1' , 'recognizes \'1\' as true' ); |
18 |
is( true_p('-1'), '1', 'recognizes \'-1\' as true' ); |
18 |
is( true_p('-1') , '1' , 'recognizes \'-1\' as true' ); |
19 |
is( true_p('t'), '1', 'recognizes \'t\' as true' ); |
19 |
is( true_p('t') , '1' , 'recognizes \'t\' as true' ); |
20 |
is( true_p('true'), '1', 'recognizes \'true\' as true' ); |
20 |
is( true_p('true') , '1' , 'recognizes \'true\' as true' ); |
21 |
is( true_p('on'), '1', 'recognizes \'on\' as true' ); |
21 |
is( true_p('on') , '1' , 'recognizes \'on\' as true' ); |
22 |
is( true_p('yes'), '1', 'recognizes \'yes\' as true' ); |
22 |
is( true_p('yes') , '1' , 'recognizes \'yes\' as true' ); |
23 |
is( true_p('y'), '1', 'recognizes \'y\' as true' ); |
23 |
is( true_p('y') , '1' , 'recognizes \'y\' as true' ); |
24 |
is( true_p('YES'), '1', 'verified case insensitivity' ); |
24 |
is( true_p('YES') , '1' , 'verified case insensitivity' ); |
25 |
|
25 |
|
26 |
is( true_p(undef), undef, 'recognizes undefined as not boolean' ); |
26 |
is( true_p(undef) , undef, 'recognizes undefined as not boolean' ); |
27 |
is( true_p('foo'), undef, 'recognizes \'foo\' as not boolean' ); |
27 |
is( true_p('foo') , undef, 'recognizes \'foo\' as not boolean' ); |
28 |
is( true_p([]), undef, 'recognizes a reference as not a boolean' ); |
28 |
is( true_p([]) , undef, 'recognizes a reference as not a boolean' ); |
29 |
- |
|
|