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/695abcc73d1d
branches:  trunk
changeset: 945274:695abcc73d1d
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 d28c05a7f3fa -r 695abcc73d1d 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 d28c05a7f3fa -r 695abcc73d1d 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