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 test for an obscure edg...



details:   https://anonhg.NetBSD.org/src/rev/b339e347db54
branches:  trunk
changeset: 935519:b339e347db54
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jul 04 16:15:21 2020 +0000

description:
make(1): add test for an obscure edge case of using the :@ modifier

diffstat:

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

diffs (37 lines):

diff -r c7c6570fd4db -r b339e347db54 usr.bin/make/unit-tests/modmisc.exp
--- a/usr.bin/make/unit-tests/modmisc.exp       Sat Jul 04 15:44:07 2020 +0000
+++ b/usr.bin/make/unit-tests/modmisc.exp       Sat Jul 04 16:15:21 2020 +0000
@@ -30,4 +30,5 @@
 :C,word,____,:Q}:
 :a c:
 :x__ 3 x__ 3:
+:+one+ +two+ +three+:
 exit status 0
diff -r c7c6570fd4db -r b339e347db54 usr.bin/make/unit-tests/modmisc.mk
--- a/usr.bin/make/unit-tests/modmisc.mk        Sat Jul 04 15:44:07 2020 +0000
+++ b/usr.bin/make/unit-tests/modmisc.mk        Sat Jul 04 16:15:21 2020 +0000
@@ -1,4 +1,4 @@
-# $Id: modmisc.mk,v 1.8 2020/07/04 09:21:30 rillig Exp $
+# $Id: modmisc.mk,v 1.9 2020/07/04 16:15:21 rillig Exp $
 #
 # miscellaneous modifier tests
 
@@ -16,7 +16,7 @@
 MOD_SEP=S,:, ,g
 
 all:   modvar modvarloop modsysv mod-HTE emptyvar undefvar
-all:   mod-S mod-C
+all:   mod-S mod-C mod-at-varname
 
 modsysv:
        @echo "The answer is ${libfoo.a:L:libfoo.a=42}"
@@ -74,3 +74,9 @@
        @echo :${:Uword1 word2:C,****,____,g:C,word,____,:Q}:
        @echo :${:Ua b b c:C,b,,g:Q}:
        @echo :${:U1 2 3 1 2 3:C,1 2,___,Wg:C,_,x,:Q}:
+
+# In the :@ modifier, the name of the loop variable can even be generated
+# dynamically.  There's no practical use-case for this, and hopefully nobody
+# will ever depend on this, but technically it's possible.
+mod-at-varname:
+       @echo :${:Uone two three:@${:Ubar:S,b,v,}@+${var}+@:Q}:



Home | Main Index | Thread Index | Old Index