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 .export and Va...



details:   https://anonhg.NetBSD.org/src/rev/552f2110e732
branches:  trunk
changeset: 1015646:552f2110e732
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Oct 29 17:27:12 2020 +0000

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

diffstat:

 usr.bin/make/unit-tests/directive-export.mk |  19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diffs (30 lines):

diff -r 6d0da562af69 -r 552f2110e732 usr.bin/make/unit-tests/directive-export.mk
--- a/usr.bin/make/unit-tests/directive-export.mk       Thu Oct 29 16:35:33 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-export.mk       Thu Oct 29 17:27:12 2020 +0000
@@ -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:
        @:;



Home | Main Index | Thread Index | Old Index