Module Name: src
Committed By: rillig
Date: Sun Jul 19 14:23:02 UTC 2020
Modified Files:
src/usr.bin/make/unit-tests: sysv.exp sysv.mk
Log Message:
make(1): add test for ampersand in SysV substitution modifier
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/sysv.exp
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/sysv.mk
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/unit-tests/sysv.exp
diff -u src/usr.bin/make/unit-tests/sysv.exp:1.4 src/usr.bin/make/unit-tests/sysv.exp:1.5
--- src/usr.bin/make/unit-tests/sysv.exp:1.4 Fri Jul 3 19:29:25 2020
+++ src/usr.bin/make/unit-tests/sysv.exp Sun Jul 19 14:23:02 2020
@@ -13,4 +13,6 @@ asam.c
a.c.c
ax:Q b c d eb
+bcd.e
+a.bcd.e
exit status 0
Index: src/usr.bin/make/unit-tests/sysv.mk
diff -u src/usr.bin/make/unit-tests/sysv.mk:1.5 src/usr.bin/make/unit-tests/sysv.mk:1.6
--- src/usr.bin/make/unit-tests/sysv.mk:1.5 Fri Jul 3 19:29:25 2020
+++ src/usr.bin/make/unit-tests/sysv.mk Sun Jul 19 14:23:02 2020
@@ -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}