Module Name: src
Committed By: rillig
Date: Fri Oct 30 17:55:11 UTC 2020
Modified Files:
src/usr.bin/make/unit-tests: directive-unexport.exp
directive-unexport.mk
Log Message:
make(1): add test for an edge case of .unexport
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/directive-unexport.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/directive-unexport.mk
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/unit-tests/directive-unexport.exp
diff -u src/usr.bin/make/unit-tests/directive-unexport.exp:1.1 src/usr.bin/make/unit-tests/directive-unexport.exp:1.2
--- src/usr.bin/make/unit-tests/directive-unexport.exp:1.1 Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/directive-unexport.exp Fri Oct 30 17:55:10 2020
@@ -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
Index: src/usr.bin/make/unit-tests/directive-unexport.mk
diff -u src/usr.bin/make/unit-tests/directive-unexport.mk:1.2 src/usr.bin/make/unit-tests/directive-unexport.mk:1.3
--- src/usr.bin/make/unit-tests/directive-unexport.mk:1.2 Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/directive-unexport.mk Fri Oct 30 17:55:10 2020
@@ -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:
@:;