Module Name: src
Committed By: rillig
Date: Sat Aug 1 17:20:42 UTC 2020
Modified Files:
src/usr.bin/make/unit-tests: modmisc.exp modmisc.mk
Log Message:
make(1): add tests for indirect modifiers
To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/make/unit-tests/modmisc.exp
cvs rdiff -u -r1.30 -r1.31 src/usr.bin/make/unit-tests/modmisc.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/modmisc.exp
diff -u src/usr.bin/make/unit-tests/modmisc.exp:1.33 src/usr.bin/make/unit-tests/modmisc.exp:1.34
--- src/usr.bin/make/unit-tests/modmisc.exp:1.33 Fri Jul 31 14:36:58 2020
+++ src/usr.bin/make/unit-tests/modmisc.exp Sat Aug 1 17:20:42 2020
@@ -1,3 +1,4 @@
+make: Unknown modifier '$'
path=':/bin:/tmp::/:.:/no/such/dir:.'
path='/bin:/tmp:/:/no/such/dir'
path='/bin:/tmp:/:/no/such/dir'
Index: src/usr.bin/make/unit-tests/modmisc.mk
diff -u src/usr.bin/make/unit-tests/modmisc.mk:1.30 src/usr.bin/make/unit-tests/modmisc.mk:1.31
--- src/usr.bin/make/unit-tests/modmisc.mk:1.30 Fri Jul 31 14:36:58 2020
+++ src/usr.bin/make/unit-tests/modmisc.mk Sat Aug 1 17:20:42 2020
@@ -1,4 +1,4 @@
-# $Id: modmisc.mk,v 1.30 2020/07/31 14:36:58 rillig Exp $
+# $Id: modmisc.mk,v 1.31 2020/08/01 17:20:42 rillig Exp $
#
# miscellaneous modifier tests
@@ -296,3 +296,20 @@ mod-range:
@echo ${a b c:L:range} # ok
@echo ${a b c:L:rango} # misspelled
@echo ${a b c:L:ranger} # modifier name too long
+
+# To apply a modifier indirectly via another variable, the whole
+# modifier must be put into a single variable.
+.if ${value:L:${:US}${:U,value,replacement,}} != "S,value,replacement,}"
+.warning unexpected
+.endif
+
+# Adding another level of indirection (the 2 nested :U expressions) helps.
+.if ${value:L:${:U${:US}${:U,value,replacement,}}} != "replacement"
+.warning unexpected
+.endif
+
+# Multiple indirect modifiers can be applied one after another as long as
+# they are separated with colons.
+.if ${value:L:${:US,a,A,}:${:US,e,E,}} != "vAluE"
+.warning unexpected
+.endif