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 an edge case o...



details:   https://anonhg.NetBSD.org/src/rev/b204a7421131
branches:  trunk
changeset: 956435:b204a7421131
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Oct 30 17:55:10 2020 +0000

description:
make(1): add test for an edge case of .unexport

diffstat:

 usr.bin/make/unit-tests/directive-unexport.exp |   4 ++++
 usr.bin/make/unit-tests/directive-unexport.mk  |  21 ++++++++++++++++++++-
 2 files changed, 24 insertions(+), 1 deletions(-)

diffs (41 lines):

diff -r 7c04530d3c6d -r b204a7421131 usr.bin/make/unit-tests/directive-unexport.exp
--- a/usr.bin/make/unit-tests/directive-unexport.exp    Fri Oct 30 17:10:48 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-unexport.exp    Fri Oct 30 17:55:10 2020 +0000
@@ -1,1 +1,5 @@
+make: "directive-unexport.mk" line 14: A=a B=b C=c
+make: "directive-unexport.mk" line 15: A B C
+make: "directive-unexport.mk" line 23: A=a B=b C=c
+make: "directive-unexport.mk" line 24: 
 exit status 0
diff -r 7c04530d3c6d -r b204a7421131 usr.bin/make/unit-tests/directive-unexport.mk
--- a/usr.bin/make/unit-tests/directive-unexport.mk     Fri Oct 30 17:10:48 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-unexport.mk     Fri Oct 30 17:55:10 2020 +0000
@@ -1,8 +1,27 @@
-# $NetBSD: directive-unexport.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: directive-unexport.mk,v 1.3 2020/10/30 17:55:10 rillig Exp $
 #
 # Tests for the .unexport directive.
 
 # TODO: Implementation
 
+# First, export 3 variables.
+A=     a
+B=     b
+C=     c
+.export A B C
+
+# Show the exported variables and their values.
+.info ${:!env|sort|grep -v -E '^(MAKELEVEL|MALLOC_OPTIONS|PATH|PWD)'!}
+.info ${.MAKE.EXPORTED}
+
+# XXX: Now try to unexport all of them.  The variables are still exported
+# but not mentioned in .MAKE.EXPORTED anymore.
+# See the ":N" in Var_UnExport for the implementation.
+*=     asterisk
+.unexport *
+
+.info ${:!env|sort|grep -v -E '^(MAKELEVEL|MALLOC_OPTIONS|PATH|PWD)'!}
+.info ${.MAKE.EXPORTED}
+
 all:
        @:;



Home | Main Index | Thread Index | Old Index