Home | History | Annotate | Line # | Download | only in unit-tests
directive-export.mk revision 1.4
      1  1.4  rillig # $NetBSD: directive-export.mk,v 1.4 2020/11/03 17:17:31 rillig Exp $
      2  1.1  rillig #
      3  1.2  rillig # Tests for the .export directive.
      4  1.1  rillig 
      5  1.1  rillig # TODO: Implementation
      6  1.1  rillig 
      7  1.3  rillig INDIRECT=	indirect
      8  1.3  rillig VAR=		value $$ ${INDIRECT}
      9  1.3  rillig 
     10  1.3  rillig # A variable is exported using the .export directive.
     11  1.3  rillig # During that, its value is expanded, just like almost everywhere else.
     12  1.3  rillig .export VAR
     13  1.3  rillig .if ${:!env | grep '^VAR'!} != "VAR=value \$ indirect"
     14  1.3  rillig .  error
     15  1.3  rillig .endif
     16  1.3  rillig 
     17  1.3  rillig # Undefining a variable that has been exported implicitly removes it from
     18  1.3  rillig # the environment of all child processes.
     19  1.3  rillig .undef VAR
     20  1.3  rillig .if ${:!env | grep '^VAR' || true!} != ""
     21  1.3  rillig .  error
     22  1.3  rillig .endif
     23  1.3  rillig 
     24  1.4  rillig # Tests for parsing the .export directive.
     25  1.4  rillig .expor				# misspelled
     26  1.4  rillig .export				# oops: missing argument
     27  1.4  rillig .export VARNAME
     28  1.4  rillig .exporting works		# oops: misspelled
     29  1.4  rillig 
     30  1.1  rillig all:
     31  1.1  rillig 	@:;
     32