Home | History | Annotate | Line # | Download | only in unit-tests
cond-eof.mk revision 1.6.2.1
      1  1.6.2.1  perseant # $NetBSD: cond-eof.mk,v 1.6.2.1 2025/08/02 05:58:31 perseant Exp $
      2      1.1    rillig #
      3      1.4    rillig # Tests for parsing the end of '.if' conditions, which are represented as the
      4      1.4    rillig # token TOK_EOF.
      5      1.4    rillig 
      6      1.1    rillig 
      7      1.1    rillig SIDE_EFFECT=	${:!echo 'side effect' 1>&2!}
      8      1.2    rillig SIDE_EFFECT2=	${:!echo 'side effect 2' 1>&2!}
      9      1.1    rillig 
     10      1.1    rillig # In the following conditions, ${SIDE_EFFECT} is the position of the first
     11      1.3    rillig # parse error.  Before cond.c 1.286 from 2021-12-10, it was always fully
     12      1.6    rillig # evaluated, even if it was not necessary to expand the expression.
     13      1.3    rillig # These syntax errors are an edge case that does not occur during normal
     14      1.3    rillig # operation.  Still, it is easy to avoid evaluating these expressions, just in
     15      1.3    rillig # case they have side effects.
     16  1.6.2.1  perseant # expect+1: Malformed conditional "0 ${SIDE_EFFECT} ${SIDE_EFFECT2}"
     17      1.2    rillig .if 0 ${SIDE_EFFECT} ${SIDE_EFFECT2}
     18      1.1    rillig .endif
     19  1.6.2.1  perseant # expect+1: Malformed conditional "1 ${SIDE_EFFECT} ${SIDE_EFFECT2}"
     20      1.2    rillig .if 1 ${SIDE_EFFECT} ${SIDE_EFFECT2}
     21      1.1    rillig .endif
     22  1.6.2.1  perseant # expect+1: Malformed conditional "(0) ${SIDE_EFFECT} ${SIDE_EFFECT2}"
     23      1.2    rillig .if (0) ${SIDE_EFFECT} ${SIDE_EFFECT2}
     24      1.1    rillig .endif
     25