Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make/unit-tests make(1): add tests for indirect modi...



details:   https://anonhg.NetBSD.org/src/rev/9392750c49ff
branches:  trunk
changeset: 936678:9392750c49ff
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Aug 01 17:20:42 2020 +0000

description:
make(1): add tests for indirect modifiers

diffstat:

 usr.bin/make/unit-tests/modmisc.exp |   1 +
 usr.bin/make/unit-tests/modmisc.mk  |  19 ++++++++++++++++++-
 2 files changed, 19 insertions(+), 1 deletions(-)

diffs (38 lines):

diff -r 5e4ca9eb4a2c -r 9392750c49ff usr.bin/make/unit-tests/modmisc.exp
--- a/usr.bin/make/unit-tests/modmisc.exp       Sat Aug 01 16:27:03 2020 +0000
+++ b/usr.bin/make/unit-tests/modmisc.exp       Sat Aug 01 17:20:42 2020 +0000
@@ -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'
diff -r 5e4ca9eb4a2c -r 9392750c49ff usr.bin/make/unit-tests/modmisc.mk
--- a/usr.bin/make/unit-tests/modmisc.mk        Sat Aug 01 16:27:03 2020 +0000
+++ b/usr.bin/make/unit-tests/modmisc.mk        Sat Aug 01 17:20:42 2020 +0000
@@ -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 @@
        @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



Home | Main Index | Thread Index | Old Index