xref: /freebsd/contrib/bmake/unit-tests/directive-export.mk (revision 36d6566e5985030fd2f1100bd9c1387bbe0bd290)
1# $NetBSD: directive-export.mk,v 1.3 2020/10/29 17:27:12 rillig Exp $
2#
3# Tests for the .export directive.
4
5# TODO: Implementation
6
7INDIRECT=	indirect
8VAR=		value $$ ${INDIRECT}
9
10# A variable is exported using the .export directive.
11# During that, its value is expanded, just like almost everywhere else.
12.export VAR
13.if ${:!env | grep '^VAR'!} != "VAR=value \$ indirect"
14.  error
15.endif
16
17# Undefining a variable that has been exported implicitly removes it from
18# the environment of all child processes.
19.undef VAR
20.if ${:!env | grep '^VAR' || true!} != ""
21.  error
22.endif
23
24all:
25	@:;
26