make(1): add tests for :!...! parse errors

This commit is contained in:
rillig 2020-07-26 14:39:46 +00:00
parent ddd4654428
commit 9a9cf6b25b
2 changed files with 16 additions and 1 deletions

View File

@ -26,4 +26,9 @@ make: Unclosed substitution for UNDEF (] missing)
13=
12345=ok
Expect: 2 errors about missing ! delimiter
make: Unclosed substitution for VARNAME (! missing)
make: Unclosed substitution for ! (! missing)
exit status 0

View File

@ -1,4 +1,4 @@
# $Id: moderrs.mk,v 1.3 2020/07/26 14:16:45 rillig Exp $
# $Id: moderrs.mk,v 1.4 2020/07/26 14:39:46 rillig Exp $
#
# various modifier error tests
@ -10,6 +10,7 @@ MOD_S:= ${MOD_TERM},
all: modunkn modunknV varterm vartermV modtermV modloop
all: modwords
all: modexclam
modunkn:
@echo "Expect: Unknown modifier 'Z'"
@ -57,3 +58,12 @@ modwords:
# This results in a range from LONG_MAX - 1 to 3,
# which is empty.
@echo 12345=${UNDEF:U1 2 3:[123451234512345123451234512345]:S,^$,ok,:S,^3$,ok,}
modexclam:
@echo "Expect: 2 errors about missing ! delimiter"
@echo ${VARNAME:!echo}
# When the final exclamation mark is missing, there is no
# fallback to the SysV substitution modifier.
# If there were a fallback, the output would be "exclam",
# and the above would have produced an "Unknown modifier '!'".
@echo ${!:L:!=exclam}