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 the ::+= modif...



details:   https://anonhg.NetBSD.org/src/rev/7039a9110584
branches:  trunk
changeset: 956017:7039a9110584
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Oct 18 21:37:24 2020 +0000

description:
make(1): add test for the ::+= modifier expanding its right-hand side

diffstat:

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

diffs (27 lines):

diff -r 0eb43f7fbc96 -r 7039a9110584 usr.bin/make/unit-tests/varmod-assign.mk
--- a/usr.bin/make/unit-tests/varmod-assign.mk  Sun Oct 18 21:36:22 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-assign.mk  Sun Oct 18 21:37:24 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-assign.mk,v 1.7 2020/10/18 21:36:22 rillig Exp $
+# $NetBSD: varmod-assign.mk,v 1.8 2020/10/18 21:37:24 rillig Exp $
 #
 # Tests for the obscure ::= variable modifiers, which perform variable
 # assignments during evaluation, just like the = operator in C.
@@ -91,3 +91,17 @@
        # FIXME: the error message says: "previous" returned non-zero status
        @${SH_ERR::=previous}
        @${SH_ERR::!= echo word; false } echo err=${SH_ERR}
+
+# 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
+APPEND.var=            ${APPEND.prev}
+APPEND.indirect=       indirect $${:Unot expanded}
+APPEND.dollar=         $${APPEND.indirect}
+.if ${APPEND.var::+=${APPEND.dollar}} != ""
+.  error
+.endif
+.if ${APPEND.var} != "previous indirect \${:Unot expanded}"
+.  error
+.endif



Home | Main Index | Thread Index | Old Index