Module Name:    src
Committed By:   rillig
Date:           Sat Jul  4 16:15:21 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: modmisc.exp modmisc.mk

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


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/modmisc.exp
cvs rdiff -u -r1.8 -r1.9 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.9 src/usr.bin/make/unit-tests/modmisc.exp:1.10
--- src/usr.bin/make/unit-tests/modmisc.exp:1.9	Sat Jul  4 09:21:30 2020
+++ src/usr.bin/make/unit-tests/modmisc.exp	Sat Jul  4 16:15:21 2020
@@ -30,4 +30,5 @@ make: Unclosed substitution for  (, miss
 :C,word,____,:Q}:
 :a c:
 :x__ 3 x__ 3:
+:+one+ +two+ +three+:
 exit status 0

Index: src/usr.bin/make/unit-tests/modmisc.mk
diff -u src/usr.bin/make/unit-tests/modmisc.mk:1.8 src/usr.bin/make/unit-tests/modmisc.mk:1.9
--- src/usr.bin/make/unit-tests/modmisc.mk:1.8	Sat Jul  4 09:21:30 2020
+++ src/usr.bin/make/unit-tests/modmisc.mk	Sat Jul  4 16:15:21 2020
@@ -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_OPT=@d@$${exists($$d):?$$d:$${d:S,/u
 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 @@ mod-C:
 	@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}:

Reply via email to