Home | History | Annotate | Line # | Download | only in unit-tests
opt-file.mk revision 1.4
      1  1.4  rillig # $NetBSD: opt-file.mk,v 1.4 2020/12/06 19:18:26 rillig Exp $
      2  1.1  rillig #
      3  1.2  rillig # Tests for the -f command line option.
      4  1.1  rillig 
      5  1.1  rillig # TODO: Implementation
      6  1.1  rillig 
      7  1.4  rillig all: .PHONY
      8  1.4  rillig all: file-ending-in-backslash
      9  1.4  rillig all: file-containing-null-byte
     10  1.3  rillig 
     11  1.3  rillig # Passing '-' as the filename reads from stdin.  This is unusual but possible.
     12  1.3  rillig #
     13  1.3  rillig # In the unlikely case where a file ends in a backslash instead of a newline,
     14  1.3  rillig # that backslash is trimmed.  See ParseGetLine.
     15  1.3  rillig file-ending-in-backslash: .PHONY
     16  1.4  rillig 	@printf '%s' 'VAR=value\' \
     17  1.4  rillig 	| ${MAKE} -r -f - -v VAR
     18  1.4  rillig 
     19  1.4  rillig # If a file contains null bytes, the rest of the line is skipped, and parsing
     20  1.4  rillig # continues in the next line.
     21  1.4  rillig #
     22  1.4  rillig # XXX: It would be safer to just quit parsing in such a situation.
     23  1.4  rillig file-containing-null-byte: .PHONY
     24  1.4  rillig 	@printf '%s\n' 'VAR=value' 'VAR2=VALUE2' \
     25  1.4  rillig 	| tr 'l' '\0' \
     26  1.4  rillig 	| ${MAKE} -r -f - -v VAR -v VAR2
     27  1.3  rillig 
     28  1.1  rillig all:
     29  1.1  rillig 	@:;
     30