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): move tests for indirect mod...
details: https://anonhg.NetBSD.org/src/rev/91fbd74c4b18
branches: trunk
changeset: 958033:91fbd74c4b18
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Dec 20 19:29:06 2020 +0000
description:
make(1): move tests for indirect modifiers around
The next commit will error out on unknown modifiers and influence the
exit status. The test modmisc.mk contains both parse time tests and run
time tests. To prevent the latter from being run, the parse error is
moved to varmod-indirect.mk, which only contains parse time tests.
diffstat:
usr.bin/make/unit-tests/modmisc.exp | 1 -
usr.bin/make/unit-tests/modmisc.mk | 29 +-------------------------
usr.bin/make/unit-tests/varmod-indirect.exp | 1 +
usr.bin/make/unit-tests/varmod-indirect.mk | 32 ++++++++++++++++++++++++++++-
4 files changed, 33 insertions(+), 30 deletions(-)
diffs (100 lines):
diff -r ad29184dbe97 -r 91fbd74c4b18 usr.bin/make/unit-tests/modmisc.exp
--- a/usr.bin/make/unit-tests/modmisc.exp Sun Dec 20 19:10:53 2020 +0000
+++ b/usr.bin/make/unit-tests/modmisc.exp Sun Dec 20 19:29:06 2020 +0000
@@ -1,4 +1,3 @@
-make: Unknown modifier '$'
path=':/bin:/tmp::/:.:/no/such/dir:.'
path='/bin:/tmp:/:/no/such/dir'
path='/bin:/tmp:/:/no/such/dir'
diff -r ad29184dbe97 -r 91fbd74c4b18 usr.bin/make/unit-tests/modmisc.mk
--- a/usr.bin/make/unit-tests/modmisc.mk Sun Dec 20 19:10:53 2020 +0000
+++ b/usr.bin/make/unit-tests/modmisc.mk Sun Dec 20 19:29:06 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: modmisc.mk,v 1.51 2020/11/15 20:20:58 rillig Exp $
+# $NetBSD: modmisc.mk,v 1.52 2020/12/20 19:29:06 rillig Exp $
#
# miscellaneous modifier tests
@@ -63,30 +63,3 @@
# Cover the bmake_realloc in Str_Words.
mod-break-many-words:
@echo $@: ${UNDEF:U:range=500:[#]}
-
-# To apply a modifier indirectly via another variable, the whole
-# modifier must be put into a single variable expression.
-.if ${value:L:${:US}${:U,value,replacement,}} != "S,value,replacement,}"
-. warning unexpected
-.endif
-
-# Adding another level of indirection (the 2 nested :U expressions) helps.
-.if ${value:L:${:U${:US}${:U,value,replacement,}}} != "replacement"
-. warning unexpected
-.endif
-
-# Multiple indirect modifiers can be applied one after another as long as
-# they are separated with colons.
-.if ${value:L:${:US,a,A,}:${:US,e,E,}} != "vAluE"
-. warning unexpected
-.endif
-
-# An indirect variable that evaluates to the empty string is allowed though.
-# This makes it possible to define conditional modifiers, like this:
-#
-# M.little-endian= S,1234,4321,
-# M.big-endian= # none
-.if ${value:L:${:Dempty}S,a,A,} != "vAlue"
-. warning unexpected
-.endif
-
diff -r ad29184dbe97 -r 91fbd74c4b18 usr.bin/make/unit-tests/varmod-indirect.exp
--- a/usr.bin/make/unit-tests/varmod-indirect.exp Sun Dec 20 19:10:53 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-indirect.exp Sun Dec 20 19:29:06 2020 +0000
@@ -1,1 +1,2 @@
+make: Unknown modifier '$'
exit status 0
diff -r ad29184dbe97 -r 91fbd74c4b18 usr.bin/make/unit-tests/varmod-indirect.mk
--- a/usr.bin/make/unit-tests/varmod-indirect.mk Sun Dec 20 19:10:53 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-indirect.mk Sun Dec 20 19:29:06 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-indirect.mk,v 1.1 2020/12/01 22:16:36 rillig Exp $
+# $NetBSD: varmod-indirect.mk,v 1.2 2020/12/20 19:29:06 rillig Exp $
#
# Tests for indirect variable modifiers, such as in ${VAR:${M_modifiers}}.
# These can be used for very basic purposes like converting a string to either
@@ -8,6 +8,36 @@
# TODO: Since when are indirect modifiers supported?
+# To apply a modifier indirectly via another variable, the whole
+# modifier must be put into a single variable expression.
+.if ${value:L:${:US}${:U,value,replacement,}} != "S,value,replacement,}"
+. warning unexpected
+.endif
+
+
+# Adding another level of indirection (the 2 nested :U expressions) helps.
+.if ${value:L:${:U${:US}${:U,value,replacement,}}} != "replacement"
+. warning unexpected
+.endif
+
+
+# Multiple indirect modifiers can be applied one after another as long as
+# they are separated with colons.
+.if ${value:L:${:US,a,A,}:${:US,e,E,}} != "vAluE"
+. warning unexpected
+.endif
+
+
+# An indirect variable that evaluates to the empty string is allowed though.
+# This makes it possible to define conditional modifiers, like this:
+#
+# M.little-endian= S,1234,4321,
+# M.big-endian= # none
+.if ${value:L:${:Dempty}S,a,A,} != "vAlue"
+. warning unexpected
+.endif
+
+
# The nested variable expression expands to "tu", and this is interpreted as
# a variable modifier for the value "Upper", resulting in "UPPER".
.if ${Upper:L:${:Utu}} != "UPPER"
Home |
Main Index |
Thread Index |
Old Index