xref: /freebsd/contrib/bmake/unit-tests/directive-for-generating-endif.mk (revision 148ee84570001f46b7b667c86573d378101c3801)
1# $NetBSD: directive-for-generating-endif.mk,v 1.2 2023/06/01 20:56:35 rillig Exp $
2#
3# Test whether a .for loop can be used to generate multiple .endif
4# directives to close nested .if directives.  Depending on the exact
5# implementation, this might have been possible.
6#
7# If it were possible, the 3 .if directives would perfectly match the
8# 3 .endif directives generated by the .for loop.
9#
10# After the "included file" from the .for loop, the 3 .if directives
11# are still open.
12#
13# See For_Run and ParseReadLine.  Each .for loop is treated like a separately
14# included file, and in each included file the .if/.endif directives must be
15# balanced.
16
17.if 1
18.  if 2
19.    if 3
20.for i in 3 2 1
21# expect+3: if-less endif
22# expect+2: if-less endif
23# expect+1: if-less endif
24.endif
25.endfor
26
27all:
28	@:;
29# expect+1: 3 open conditionals
30