make(1): add test for ampersand in SysV substitution modifier

This commit is contained in:
rillig 2020-07-19 14:23:02 +00:00
parent 98eae199aa
commit ce9c1c2a77
2 changed files with 13 additions and 3 deletions

View File

@ -13,4 +13,6 @@ asam.c
a.c.c
ax:Q b c d eb
bcd.e
a.bcd.e
exit status 0

View File

@ -1,4 +1,6 @@
# $Id: sysv.mk,v 1.5 2020/07/03 19:29:25 rillig Exp $
# $Id: sysv.mk,v 1.6 2020/07/19 14:23:02 rillig Exp $
all: foo fun sam bla words ampersand
FOO ?=
FOOBAR = ${FOO:=bar}
@ -11,8 +13,6 @@ FUN = ${B}${S}fun
SUN = the Sun
# we expect nothing when FOO is empty
all: foo fun sam bla words
foo:
@echo FOOBAR = ${FOOBAR}
.if empty(FOO)
@ -46,3 +46,11 @@ bla:
# It is part of the replacement string.
words:
@echo a${a b c d e:L:%a=x:Q}b
# As of 2020-07-19, an ampersand can be used in the replacement part
# of a SysV substitution modifier. This can either be an intentional
# feature or an implementation mistake, as it is not mentioned in the
# manual page.
ampersand:
@echo ${:U${a.bcd.e:L:a.%=%}:Q}
@echo ${:U${a.bcd.e:L:a.%=&}:Q}