Module Name:    src
Committed By:   rillig
Date:           Sun Sep 13 21:00:34 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: varparse-dynamic.mk

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


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/varparse-dynamic.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/varparse-dynamic.mk
diff -u src/usr.bin/make/unit-tests/varparse-dynamic.mk:1.1 src/usr.bin/make/unit-tests/varparse-dynamic.mk:1.2
--- src/usr.bin/make/unit-tests/varparse-dynamic.mk:1.1	Sun Jul 26 22:15:36 2020
+++ src/usr.bin/make/unit-tests/varparse-dynamic.mk	Sun Sep 13 21:00:34 2020
@@ -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:
 	@:

Reply via email to