This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
svleak.t: Enable syntax error tests under -Dmad
[perl5.git] / t / op / not.t
CommitLineData
a758b0b5
MHM
1#!./perl -w
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6 require './test.pl';
7}
8
1b293ed1 9plan tests => 16;
a758b0b5 10
1b293ed1 11# not() tests
a758b0b5
MHM
12pass() if not();
13is(not(), 1);
14is(not(), not(0));
1b293ed1
SP
15
16# test not(..) and !
17is(! 1, not 1);
18is(! 0, not 0);
19is(! (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}