xref: /freebsd/contrib/bmake/unit-tests/directive-export.mk (revision 78adacd4eab39a3508bd8c65f0aba94fc6b907ce)
1# $NetBSD: directive-export.mk,v 1.4 2020/11/03 17:17:31 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
24# Tests for parsing the .export directive.
25.expor				# misspelled
26.export				# oops: missing argument
27.export VARNAME
28.exporting works		# oops: misspelled
29
30all:
31	@:;
32