Home | History | Annotate | Line # | Download | only in unit-tests
directive-unexport.mk revision 1.6
      1  1.6  rillig # $NetBSD: directive-unexport.mk,v 1.6 2020/12/12 18:11:42 rillig Exp $
      2  1.1  rillig #
      3  1.2  rillig # Tests for the .unexport directive.
      4  1.6  rillig #
      5  1.6  rillig # Before 2020-12-13, misspelled directives like ".unexporting" or
      6  1.6  rillig # ".unexport-en" had not been detected properly.
      7  1.1  rillig 
      8  1.3  rillig # First, export 3 variables.
      9  1.4     sjg UT_A=	a
     10  1.4     sjg UT_B=	b
     11  1.4     sjg UT_C=	c
     12  1.4     sjg .export UT_A UT_B UT_C
     13  1.3  rillig 
     14  1.3  rillig # Show the exported variables and their values.
     15  1.4     sjg .info ${:!env|sort|grep '^UT_'!}
     16  1.3  rillig .info ${.MAKE.EXPORTED}
     17  1.3  rillig 
     18  1.3  rillig # XXX: Now try to unexport all of them.  The variables are still exported
     19  1.3  rillig # but not mentioned in .MAKE.EXPORTED anymore.
     20  1.3  rillig # See the ":N" in Var_UnExport for the implementation.
     21  1.3  rillig *=	asterisk
     22  1.3  rillig .unexport *
     23  1.3  rillig 
     24  1.4     sjg .info ${:!env|sort|grep '^UT_'!}
     25  1.3  rillig .info ${.MAKE.EXPORTED}
     26  1.3  rillig 
     27  1.5  rillig .unexpor			# misspelled
     28  1.5  rillig .unexport			# oops: missing argument
     29  1.6  rillig .unexporting works		# misspelled
     30  1.5  rillig 
     31  1.1  rillig all:
     32  1.1  rillig 	@:;
     33