Home | History | Annotate | Line # | Download | only in unit-tests
cond-op-and.mk revision 1.4
      1 # $NetBSD: cond-op-and.mk,v 1.4 2020/09/10 22:38:57 rillig Exp $
      2 #
      3 # Tests for the && operator in .if conditions.
      4 
      5 .if 0 && 0
      6 .error
      7 .endif
      8 
      9 .if 1 && 0
     10 .error
     11 .endif
     12 
     13 .if 0 && 1
     14 .error
     15 .endif
     16 
     17 .if !(1 && 1)
     18 .error
     19 .endif
     20 
     21 # The right-hand side is not evaluated since the left-hand side is already
     22 # false.
     23 .if 0 && ${UNDEF}
     24 .endif
     25 
     26 # The && operator may be abbreviated as &.  This is not widely known though
     27 # and is also not documented in the manual page.
     28 
     29 .if 0 & 0
     30 .  error
     31 .endif
     32 .if 1 & 0
     33 .  error
     34 .endif
     35 .if 0 & 1
     36 .  error
     37 .endif
     38 .if !(1 & 1)
     39 .  error
     40 .endif
     41 
     42 # There is no operator &&&.
     43 .if 0 &&& 0
     44 .  error
     45 .endif
     46 
     47 all:
     48 	@:;
     49