xref: /freebsd/contrib/bmake/unit-tests/cond-op-and.mk (revision c66ec88fed842fbaad62c30d510644ceb7bd2d71)
1# $NetBSD: cond-op-and.mk,v 1.5 2020/10/24 08:46:08 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
47all:
48	@:;
49