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 stray dollar s...



details:   https://anonhg.NetBSD.org/src/rev/691f024b1a49
branches:  trunk
changeset: 936120:691f024b1a49
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jul 19 15:16:22 2020 +0000

description:
make(1): add test for stray dollar signs in :@ modifier

diffstat:

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

diffs (46 lines):

diff -r abab58e50e5d -r 691f024b1a49 usr.bin/make/unit-tests/modmisc.exp
--- a/usr.bin/make/unit-tests/modmisc.exp       Sun Jul 19 14:43:35 2020 +0000
+++ b/usr.bin/make/unit-tests/modmisc.exp       Sun Jul 19 15:16:22 2020 +0000
@@ -32,6 +32,9 @@
 :x__ 3 x__ 3:
 :+one+ +two+ +three+:
 mod-at-resolve:w1d2d3w w2i3w w1i2d3 2i${RES3}w w1d2d3 2i${RES3} 1i${RES2}w:
+mod-at-dollar:(1) (2) (3).
+mod-at-dollar:(1) (2) (3).
+mod-at-dollar:() () ().
 mod-subst-dollar:$1:
 mod-subst-dollar:$2:
 mod-subst-dollar:$3:
diff -r abab58e50e5d -r 691f024b1a49 usr.bin/make/unit-tests/modmisc.mk
--- a/usr.bin/make/unit-tests/modmisc.mk        Sun Jul 19 14:43:35 2020 +0000
+++ b/usr.bin/make/unit-tests/modmisc.mk        Sun Jul 19 15:16:22 2020 +0000
@@ -1,4 +1,4 @@
-# $Id: modmisc.mk,v 1.12 2020/07/04 18:54:18 rillig Exp $
+# $Id: modmisc.mk,v 1.13 2020/07/19 15:16:22 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 mod-at-varname mod-at-resolve
+all:   mod-S mod-C mod-at-varname mod-at-resolve mod-at-dollar
 all:   mod-subst-dollar mod-loop-dollar
 
 modsysv:
@@ -95,6 +95,14 @@
 mod-at-resolve:
        @echo $@:${RESOLVE:@v@w${v}w@:Q}:
 
+# As of 2020-07-19, the variable name of the :@ modifier may end with one
+# or two dollar signs, which are silently ignored.  There's no point in
+# allowing a dollar sign in that position.
+mod-at-dollar:
+       @echo $@:${1 2 3:L:@v$@($v)@:Q}.
+       @echo $@:${1 2 3:L:@v$$@($v)@:Q}.
+       @echo $@:${1 2 3:L:@v$$$@($v)@:Q}.
+
 # No matter how many dollar characters there are, they all get merged
 # into a single dollar by the :S modifier.
 mod-subst-dollar:



Home | Main Index | Thread Index | Old Index