xref: /freebsd/contrib/bmake/unit-tests/cond-token-var.mk (revision 6132212808e8dccedc9e5d85fea4390c2f38059a)
1# $NetBSD: cond-token-var.mk,v 1.3 2020/08/20 19:43:42 rillig Exp $
2#
3# Tests for variables in .if conditions.
4
5DEF=	defined
6
7# A defined variable may appear on either side of the comparison.
8.if ${DEF} == ${DEF}
9.info ok
10.else
11.error
12.endif
13
14# A variable that appears on the left-hand side must be defined.
15.if ${UNDEF} == ${DEF}
16.error
17.endif
18
19# A variable that appears on the right-hand side must be defined.
20.if ${DEF} == ${UNDEF}
21.error
22.endif
23
24# A defined variable may appear as an expression of its own.
25.if ${DEF}
26.endif
27
28# An undefined variable generates a warning.
29.if ${UNDEF}
30.endif
31
32# The :U modifier turns an undefined variable into an ordinary expression.
33.if ${UNDEF:U}
34.endif
35