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 chaining the :...
details: https://anonhg.NetBSD.org/src/rev/dc0eb402b9d2
branches: trunk
changeset: 1012447:dc0eb402b9d2
user: rillig <rillig%NetBSD.org@localhost>
date: Fri Jul 31 14:36:58 2020 +0000
description:
make(1): add test for chaining the :S modifier without colon
diffstat:
usr.bin/make/unit-tests/modmisc.exp | 2 ++
usr.bin/make/unit-tests/modmisc.mk | 15 ++++++++++++++-
2 files changed, 16 insertions(+), 1 deletions(-)
diffs (48 lines):
diff -r 69a44890c36a -r dc0eb402b9d2 usr.bin/make/unit-tests/modmisc.exp
--- a/usr.bin/make/unit-tests/modmisc.exp Fri Jul 31 14:26:22 2020 +0000
+++ b/usr.bin/make/unit-tests/modmisc.exp Fri Jul 31 14:36:58 2020 +0000
@@ -24,6 +24,8 @@
:a c:
:x__ 3 x__ 3:
12345
+mod-subst-chain:
+A B c.
mod-regex:
:a b b c:
:a b b c:
diff -r 69a44890c36a -r dc0eb402b9d2 usr.bin/make/unit-tests/modmisc.mk
--- a/usr.bin/make/unit-tests/modmisc.mk Fri Jul 31 14:26:22 2020 +0000
+++ b/usr.bin/make/unit-tests/modmisc.mk Fri Jul 31 14:36:58 2020 +0000
@@ -1,4 +1,4 @@
-# $Id: modmisc.mk,v 1.29 2020/07/29 21:35:35 rillig Exp $
+# $Id: modmisc.mk,v 1.30 2020/07/31 14:36:58 rillig Exp $
#
# miscellaneous modifier tests
@@ -17,6 +17,7 @@
all: modvar modvarloop modsysv mod-HTE emptyvar undefvar
all: mod-subst
+all: mod-subst-chain
all: mod-regex
all: mod-loop-varname mod-loop-resolve mod-loop-varname-dollar
all: mod-subst-dollar mod-loop-dollar
@@ -136,6 +137,18 @@
@echo :${:U1 2 3 1 2 3:S,1 2,___,Wg:S,_,x,:Q}:
@echo ${:U12345:S,,sep,g:Q}
+# The :S and :C modifiers can be chained without a separating ':'.
+# This is not documented in the manual page.
+# It works because ApplyModifier_Subst scans for the known modifiers g1W
+# and then just returns to ApplyModifiers. There, the colon is optionally
+# skipped (see the *st.next == ':' at the end of the loop).
+#
+# Most other modifiers cannot be chained since their parsers skip until
+# the next ':' or '}' or ')'.
+mod-subst-chain:
+ @echo $@:
+ @echo ${:Ua b c:S,a,A,S,b,B,}.
+
mod-regex:
@echo $@:
@echo :${:Ua b b c:C,a b,,:Q}:
Home |
Main Index |
Thread Index |
Old Index