This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
... / ...
Commit | Line | Data |
| 1 | #!./perl -w |
| 2 | |
| 3 | BEGIN { |
| 4 | chdir 't' if -d 't'; |
| 5 | @INC = '../lib'; |
| 6 | require './test.pl'; |
| 7 | } |
| 8 | |
| 9 | plan tests => 16; |
| 10 | |
| 11 | # not() tests |
| 12 | pass() if not(); |
| 13 | is(not(), 1); |
| 14 | is(not(), not(0)); |
| 15 | |
| 16 | # test not(..) and ! |
| 17 | is(! 1, not 1); |
| 18 | is(! 0, not 0); |
| 19 | is(! (0, 0), not(0, 0)); |
| 20 | |
| 21 | # test the return of ! |
| 22 | { |
| 23 | my $not0 = ! 0; |
| 24 | my $not1 = ! 1; |
| 25 | |
| 26 | no warnings; |
| 27 | ok($not1 == undef); |
| 28 | ok($not1 == ()); |
| 29 | |
| 30 | use warnings; |
| 31 | ok($not1 eq ''); |
| 32 | ok($not1 == 0); |
| 33 | ok($not0 == 1); |
| 34 | } |
| 35 | |
| 36 | # test the return of not |
| 37 | { |
| 38 | my $not0 = not 0; |
| 39 | my $not1 = not 1; |
| 40 | |
| 41 | no warnings; |
| 42 | ok($not1 == undef); |
| 43 | ok($not1 == ()); |
| 44 | |
| 45 | use warnings; |
| 46 | ok($not1 eq ''); |
| 47 | ok($not1 == 0); |
| 48 | ok($not0 == 1); |
| 49 | } |