Module Name:    src
Committed By:   rillig
Date:           Thu Oct 29 17:27:12 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: directive-export.mk

Log Message:
make(1): add test for .export and Var_Delete


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/directive-export.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-export.mk
diff -u src/usr.bin/make/unit-tests/directive-export.mk:1.2 src/usr.bin/make/unit-tests/directive-export.mk:1.3
--- src/usr.bin/make/unit-tests/directive-export.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/directive-export.mk	Thu Oct 29 17:27:12 2020
@@ -1,8 +1,25 @@
-# $NetBSD: directive-export.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: directive-export.mk,v 1.3 2020/10/29 17:27:12 rillig Exp $
 #
 # Tests for the .export directive.
 
 # TODO: Implementation
 
+INDIRECT=	indirect
+VAR=		value $$ ${INDIRECT}
+
+# A variable is exported using the .export directive.
+# During that, its value is expanded, just like almost everywhere else.
+.export VAR
+.if ${:!env | grep '^VAR'!} != "VAR=value \$ indirect"
+.  error
+.endif
+
+# Undefining a variable that has been exported implicitly removes it from
+# the environment of all child processes.
+.undef VAR
+.if ${:!env | grep '^VAR' || true!} != ""
+.  error
+.endif
+
 all:
 	@:;

Reply via email to