xref: /freebsd/contrib/bmake/unit-tests/directive-unexport.mk (revision 4543ef516683042d46f3bd3bb8a4f3f746e00499)
1# $NetBSD: directive-unexport.mk,v 1.8 2023/06/01 20:56:35 rillig Exp $
2#
3# Tests for the .unexport directive.
4#
5# Before 2020-12-13, misspelled directives like ".unexporting" or
6# ".unexport-en" had not been detected properly.
7#
8# See also:
9#	directive-misspellings.mk
10
11# First, export 3 variables.
12UT_A=	a
13UT_B=	b
14UT_C=	c
15.export UT_A UT_B UT_C
16
17# Show the exported variables and their values.
18# expect+1: UT_A=a UT_B=b UT_C=c
19.info ${:!env|sort|grep '^UT_'!}
20# expect+1: UT_A UT_B UT_C
21.info ${.MAKE.EXPORTED}
22
23# XXX: Now try to unexport all of them.  The variables are still exported
24# but not mentioned in .MAKE.EXPORTED anymore.
25# See the ":N" in Var_UnExport for the implementation.
26*=	asterisk
27.unexport *
28
29# expect+1: UT_A=a UT_B=b UT_C=c
30.info ${:!env|sort|grep '^UT_'!}
31.info ${.MAKE.EXPORTED}
32
33.unexport			# oops: missing argument
34
35all:
36	@:;
37