xref: /freebsd/contrib/bmake/unit-tests/directive-for-null.mk (revision e6bfd18d21b225af6a0ed67ceeaf1293b7b9eba5)
1# $NetBSD: directive-for-null.mk,v 1.3 2022/06/12 15:03:27 rillig Exp $
2#
3# Test for parsing a .for loop that accidentally contains a null byte.
4#
5# As of 2020-12-19, there are 3 error messages:
6#
7#	make: "(stdin)" line 2: Zero byte read from file
8#	make: "(stdin)" line 2: Unexpected end of file in for loop.
9#	make: "(stdin)" line 3: Zero byte read from file
10#
11# The one about "end of file" might be misleading but is due to the
12# implementation.  On both errors and EOF, ParseRawLine returns NULL.
13#
14# The one about the "zero byte" in line 3 is surprising since the only
15# line that contains a null byte is line 2.
16
17all: .PHONY
18	@printf '%s\n' \
19	    '.for i in 1 2 3' \
20	    'VAR=value' \
21	    '.endfor' \
22	| tr 'l' '\0' \
23	| ${MAKE} -f -
24