summaryrefslogtreecommitdiff
path: root/usr.bin/make/unit-tests/modmisc
diff options
context:
space:
mode:
authorsjg <sjg@NetBSD.org>2006-05-11 15:37:07 +0000
committersjg <sjg@NetBSD.org>2006-05-11 15:37:07 +0000
commit03cbcf6532e8656e0bc4bc53feaa8e593e42e14d (patch)
tree812dfe26961e12b6af2a6cff5809aa382332a8f9 /usr.bin/make/unit-tests/modmisc
parent6daaa2e383ede7eab11f4f90169c2e2e204b6b4d (diff)
Extract the variable modifier logic to a separate function.
This cuts Var_Parse in half! and allows the modifier logic to be used recursively - when getting modifiers via variables. Add new unit-test, to check that certain error cases are handled correctly.
Diffstat (limited to 'usr.bin/make/unit-tests/modmisc')
-rw-r--r--usr.bin/make/unit-tests/modmisc19
1 files changed, 17 insertions, 2 deletions
diff --git a/usr.bin/make/unit-tests/modmisc b/usr.bin/make/unit-tests/modmisc
index bc66711bb73..11f22eaed5a 100644
--- a/usr.bin/make/unit-tests/modmisc
+++ b/usr.bin/make/unit-tests/modmisc
@@ -1,4 +1,4 @@
-# $Id: modmisc,v 1.3 2006/02/26 22:40:50 wiz Exp $
+# $Id: modmisc,v 1.4 2006/05/11 15:37:07 sjg Exp $
#
# miscellaneous modifier tests
@@ -8,11 +8,26 @@ MOD_NODOT=S/:/ /g:N.:ts:
# and decorate, note that $'s need to be doubled. Also note that
# the modifier_variable can be used with other modifiers.
MOD_NODOTX=S/:/ /g:N.:@d@'$$d'@
+# another mod - pretend it is more interesting
+MOD_HOMES=S,/home/,/homes/,
+MOD_OPT=@d@$${exists($$d):?$$d:$${d:S,/usr,/opt,}}@
+MOD_SEP=S,:, ,g
-all: modvar
+all: modvar modvarloop
modvar:
@echo "path='${path}'"
@echo "path='${path:${MOD_NODOT}}'"
@echo "path='${path:S,home,homes,:${MOD_NODOT}}'"
@echo "path=${path:${MOD_NODOTX}:ts:}"
+ @echo "path=${path:${MOD_HOMES}:${MOD_NODOTX}:ts:}"
+
+.for d in ${path:${MOD_SEP}:N.} /usr/xbin
+path_$d?= ${d:${MOD_OPT}:${MOD_HOMES}}/
+paths+= ${d:${MOD_OPT}:${MOD_HOMES}}
+.endfor
+
+modvarloop:
+ @echo "path_/usr/xbin=${path_/usr/xbin}"
+ @echo "paths=${paths}"
+ @echo "PATHS=${paths:tu}"