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 setting a vari...



details:   https://anonhg.NetBSD.org/src/rev/ce0423605e3b
branches:  trunk
changeset: 1015521:ce0423605e3b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Oct 25 09:46:25 2020 +0000

description:
make(1): add test for setting a variable in a GNode context

This edge case is probably not used widely.  The local variables of a
GNode should only ever be the predefined variables.

diffstat:

 usr.bin/make/unit-tests/var-class-local.exp |  1 +
 usr.bin/make/unit-tests/var-class-local.mk  |  7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r 71967b4e8bf3 -r ce0423605e3b usr.bin/make/unit-tests/var-class-local.exp
--- a/usr.bin/make/unit-tests/var-class-local.exp       Sun Oct 25 09:30:45 2020 +0000
+++ b/usr.bin/make/unit-tests/var-class-local.exp       Sun Oct 25 09:46:25 2020 +0000
@@ -1,1 +1,2 @@
+: all overwritten
 exit status 0
diff -r 71967b4e8bf3 -r ce0423605e3b usr.bin/make/unit-tests/var-class-local.mk
--- a/usr.bin/make/unit-tests/var-class-local.mk        Sun Oct 25 09:30:45 2020 +0000
+++ b/usr.bin/make/unit-tests/var-class-local.mk        Sun Oct 25 09:46:25 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: var-class-local.mk,v 1.3 2020/10/23 17:21:22 rillig Exp $
+# $NetBSD: var-class-local.mk,v 1.4 2020/10/25 09:46:25 rillig Exp $
 #
 # Tests for target-local variables, such as ${.TARGET} or $@.
 
@@ -25,4 +25,7 @@
 .endif
 
 all:
-       @:;
+       # The ::= modifier overwrites the .TARGET variable in the node
+       # 'all', not in the global scope.  This can be seen with the -dv
+       # option, looking for "all:@ = overwritten".
+       : ${.TARGET} ${.TARGET::=overwritten}${.TARGET}



Home | Main Index | Thread Index | Old Index