xref: /freebsd/contrib/bmake/unit-tests/cond-eof.mk (revision cfd6422a5217410fbd66f7a7a8a64d9d85e61229)
1# $NetBSD: cond-eof.mk,v 1.2 2020/12/14 20:28:09 rillig Exp $
2#
3# Tests for parsing conditions, especially the end of such conditions, which
4# are represented as the token TOK_EOF.
5
6SIDE_EFFECT=	${:!echo 'side effect' 1>&2!}
7SIDE_EFFECT2=	${:!echo 'side effect 2' 1>&2!}
8
9# In the following conditions, ${SIDE_EFFECT} is the position of the first
10# parse error.  It is always fully evaluated, even if it were not necessary
11# to expand the variable expression.  This is because these syntax errors are
12# an edge case that does not occur during normal operation, therefore there
13# is no need to optimize for this case, and it would slow down the common
14# case as well.
15.if 0 ${SIDE_EFFECT} ${SIDE_EFFECT2}
16.endif
17.if 1 ${SIDE_EFFECT} ${SIDE_EFFECT2}
18.endif
19.if (0) ${SIDE_EFFECT} ${SIDE_EFFECT2}
20.endif
21