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