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 dynamic variab...



details:   https://anonhg.NetBSD.org/src/rev/f14fb0d1e750
branches:  trunk
changeset: 938727:f14fb0d1e750
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Sep 13 21:00:34 2020 +0000

description:
make(1): add test for dynamic variable with modifiers in Var_Parse

diffstat:

 usr.bin/make/unit-tests/varparse-dynamic.mk |  13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diffs (26 lines):

diff -r f7726a999cdf -r f14fb0d1e750 usr.bin/make/unit-tests/varparse-dynamic.mk
--- a/usr.bin/make/unit-tests/varparse-dynamic.mk       Sun Sep 13 20:59:18 2020 +0000
+++ b/usr.bin/make/unit-tests/varparse-dynamic.mk       Sun Sep 13 21:00:34 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: varparse-dynamic.mk,v 1.1 2020/07/26 22:15:36 rillig Exp $
+# $NetBSD: varparse-dynamic.mk,v 1.2 2020/09/13 21:00:34 rillig Exp $
 
 # Before 2020-07-27, there was an off-by-one error in Var_Parse that skipped
 # the last character in the variable name.
@@ -10,5 +10,16 @@
 .if ${.TARGXX}                 # 2 characters difference, must be defined
 .endif
 
+# When a dynamic variable (such as .TARGET) is evaluated in the global
+# context, it is not yet ready to be expanded.  Therefore the complete
+# expression is returned as the variable value, hoping that it can be
+# resolved at a later point.
+#
+# This test covers the code in Var_Parse that deals with VAR_JUNK but not
+# VAR_KEEP for dynamic variables.
+.if ${.TARGET:S,^,,} != "\${.TARGET:S,^,,}"
+.  error
+.endif
+
 all:
        @:



Home | Main Index | Thread Index | Old Index