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: add test for ::= modifier encl...



details:   https://anonhg.NetBSD.org/src/rev/d10f8fb3b1c3
branches:  trunk
changeset: 980659:d10f8fb3b1c3
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Feb 14 12:14:37 2021 +0000

description:
make: add test for ::= modifier enclosed in parentheses

diffstat:

 usr.bin/make/unit-tests/varmod-assign.mk |  14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r 0a41db8aafa3 -r d10f8fb3b1c3 usr.bin/make/unit-tests/varmod-assign.mk
--- a/usr.bin/make/unit-tests/varmod-assign.mk  Sun Feb 14 11:21:37 2021 +0000
+++ b/usr.bin/make/unit-tests/varmod-assign.mk  Sun Feb 14 12:14:37 2021 +0000
@@ -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 @@
        @${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 @@
 .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



Home | Main Index | Thread Index | Old Index