varmod-exclam-shell.mk (bmake-20201101) | : | varmod-exclam-shell.mk (bmake-20201117) | ||
---|---|---|---|---|
# $NetBSD: varmod-exclam-shell.mk,v 1.3 2020/10/24 08:46:08 rillig Exp $ | # $NetBSD: varmod-exclam-shell.mk,v 1.4 2020/11/03 18:42:33 rillig Exp $ | |||
# | # | |||
# Tests for the :!cmd! variable modifier. | # Tests for the :!cmd! variable modifier, which evaluates the modifier | |||
# argument, independent of the value or the name of the original variable. | ||||
.if ${:!echo hello | tr 'l' 'l'!} != "hello" | .if ${:!echo hello | tr 'l' 'l'!} != "hello" | |||
. warning unexpected | . error | |||
.endif | .endif | |||
# The output is truncated at the first null byte. | # The output is truncated at the first null byte. | |||
# Cmd_Exec returns only a string pointer without length information. | # Cmd_Exec returns only a string pointer without length information. | |||
# Truncating the output is not necessarily intended but may also be a side | ||||
# effect from the implementation. Having null bytes in the output of a | ||||
# shell command is so unusual that it doesn't matter in practice. | ||||
.if ${:!echo hello | tr 'l' '\0'!} != "he" | .if ${:!echo hello | tr 'l' '\0'!} != "he" | |||
. warning unexpected | . error | |||
.endif | .endif | |||
# The newline at the end of the output is stripped. | ||||
.if ${:!echo!} != "" | .if ${:!echo!} != "" | |||
. warning A newline at the end of the output must be stripped. | . error | |||
.endif | .endif | |||
# Only the final newline of the output is stripped. All other newlines are | ||||
# converted to spaces. | ||||
.if ${:!echo;echo!} != " " | .if ${:!echo;echo!} != " " | |||
. warning Only a single newline at the end of the output is stripped. | . error | |||
.endif | .endif | |||
# Each newline in the output is converted to a space, except for the newline | ||||
# at the end of the output, which is stripped. | ||||
.if ${:!echo;echo;echo;echo!} != " " | .if ${:!echo;echo;echo;echo!} != " " | |||
. warning Other newlines in the output are converted to spaces. | . error | |||
.endif | .endif | |||
all: | all: | |||
@:; | @:; | |||
End of changes. 11 change blocks. | ||||
7 lines changed or deleted | 16 lines changed or added |