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