xref: /freebsd/contrib/bmake/unit-tests/directive-unexport.mk (revision 148ee84570001f46b7b667c86573d378101c3801)
1*148ee845SSimon J. Gerraty# $NetBSD: directive-unexport.mk,v 1.8 2023/06/01 20:56:35 rillig Exp $
22c3632d1SSimon J. Gerraty#
32c3632d1SSimon J. Gerraty# Tests for the .unexport directive.
406b9b3e0SSimon J. Gerraty#
506b9b3e0SSimon J. Gerraty# Before 2020-12-13, misspelled directives like ".unexporting" or
606b9b3e0SSimon J. Gerraty# ".unexport-en" had not been detected properly.
706b9b3e0SSimon J. Gerraty#
806b9b3e0SSimon J. Gerraty# See also:
906b9b3e0SSimon J. Gerraty#	directive-misspellings.mk
102c3632d1SSimon J. Gerraty
11956e45f6SSimon J. Gerraty# First, export 3 variables.
12956e45f6SSimon J. GerratyUT_A=	a
13956e45f6SSimon J. GerratyUT_B=	b
14956e45f6SSimon J. GerratyUT_C=	c
15956e45f6SSimon J. Gerraty.export UT_A UT_B UT_C
16956e45f6SSimon J. Gerraty
17956e45f6SSimon J. Gerraty# Show the exported variables and their values.
18*148ee845SSimon J. Gerraty# expect+1: UT_A=a UT_B=b UT_C=c
19956e45f6SSimon J. Gerraty.info ${:!env|sort|grep '^UT_'!}
20*148ee845SSimon J. Gerraty# expect+1: UT_A UT_B UT_C
21956e45f6SSimon J. Gerraty.info ${.MAKE.EXPORTED}
22956e45f6SSimon J. Gerraty
23956e45f6SSimon J. Gerraty# XXX: Now try to unexport all of them.  The variables are still exported
24956e45f6SSimon J. Gerraty# but not mentioned in .MAKE.EXPORTED anymore.
25956e45f6SSimon J. Gerraty# See the ":N" in Var_UnExport for the implementation.
26956e45f6SSimon J. Gerraty*=	asterisk
27956e45f6SSimon J. Gerraty.unexport *
28956e45f6SSimon J. Gerraty
29*148ee845SSimon J. Gerraty# expect+1: UT_A=a UT_B=b UT_C=c
30956e45f6SSimon J. Gerraty.info ${:!env|sort|grep '^UT_'!}
31956e45f6SSimon J. Gerraty.info ${.MAKE.EXPORTED}
32956e45f6SSimon J. Gerraty
33e2eeea75SSimon J. Gerraty.unexport			# oops: missing argument
34e2eeea75SSimon J. Gerraty
352c3632d1SSimon J. Gerratyall:
362c3632d1SSimon J. Gerraty	@:;
37