Module Name:    src
Committed By:   rillig
Date:           Sun Feb 14 12:14:37 UTC 2021

Modified Files:
        src/usr.bin/make/unit-tests: varmod-assign.mk

Log Message:
make: add test for ::= modifier enclosed in parentheses


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/varmod-assign.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/varmod-assign.mk
diff -u src/usr.bin/make/unit-tests/varmod-assign.mk:1.9 src/usr.bin/make/unit-tests/varmod-assign.mk:1.10
--- src/usr.bin/make/unit-tests/varmod-assign.mk:1.9	Fri Jan 22 22:54:53 2021
+++ src/usr.bin/make/unit-tests/varmod-assign.mk	Sun Feb 14 12:14:37 2021
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-assign.mk,v 1.9 2021/01/22 22:54:53 rillig Exp $
+# $NetBSD: varmod-assign.mk,v 1.10 2021/02/14 12:14:37 rillig Exp $
 #
 # Tests for the obscure ::= variable modifiers, which perform variable
 # assignments during evaluation, just like the = operator in C.
@@ -91,7 +91,7 @@ mod-assign-shell-error:
 	@${SH_ERR::=previous}
 	@${SH_ERR::!= echo word; false } echo err=${SH_ERR}
 
-# XXX: The ::= modifier expands its right-hand side, exactly once.
+# XXX: The ::= modifier expands its right-hand side exactly once.
 # This differs subtly from normal assignments such as '+=' or '=', which copy
 # their right-hand side literally.
 APPEND.prev=		previous
@@ -104,3 +104,13 @@ APPEND.dollar=		$${APPEND.indirect}
 .if ${APPEND.var} != "previous indirect \${:Unot expanded}"
 .  error
 .endif
+
+
+# The assignment modifier can be used in a variable expression that is
+# enclosed in parentheses.  In such a case, parsing stops at the first ')',
+# not at the first '}'.
+VAR=	previous
+_:=	$(VAR::=current})
+.if ${VAR} != "current}"
+.  error
+.endif

Reply via email to