summaryrefslogtreecommitdiff
path: root/unit-tests/directive-export.mk
diff options
context:
space:
mode:
Diffstat (limited to 'unit-tests/directive-export.mk')
-rw-r--r--unit-tests/directive-export.mk19
1 files changed, 18 insertions, 1 deletions
diff --git a/unit-tests/directive-export.mk b/unit-tests/directive-export.mk
index c7f9181b4b5a..6fbf8f09d4dc 100644
--- a/unit-tests/directive-export.mk
+++ b/unit-tests/directive-export.mk
@@ -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:
@:;