Home | History | Annotate | Line # | Download | only in unit-tests
varmod-shell.mk revision 1.5
      1  1.5  rillig # $NetBSD: varmod-shell.mk,v 1.5 2020/11/17 20:11:02 rillig Exp $
      2  1.1  rillig #
      3  1.2  rillig # Tests for the :sh variable modifier, which runs the shell command
      4  1.2  rillig # given by the variable value and returns its output.
      5  1.3  rillig #
      6  1.4  rillig # This modifier has been added on 2000-04-29.
      7  1.4  rillig #
      8  1.4  rillig # See also:
      9  1.4  rillig #	ApplyModifier_ShellCommand
     10  1.1  rillig 
     11  1.1  rillig # TODO: Implementation
     12  1.1  rillig 
     13  1.4  rillig # The command to be run is enclosed between exclamation marks.
     14  1.4  rillig # The previous value of the expression is irrelevant for this modifier.
     15  1.4  rillig # The :!cmd! modifier turns an undefined expression into a defined one.
     16  1.4  rillig .if ${:!echo word!} != "word"
     17  1.4  rillig .  error
     18  1.4  rillig .endif
     19  1.4  rillig 
     20  1.4  rillig # If the command exits with non-zero, an error message is printed.
     21  1.4  rillig # XXX: Processing continues as usual though.
     22  1.4  rillig #
     23  1.5  rillig # Between 2000-04-29 and 2020-11-17, the error message mentioned the previous
     24  1.4  rillig # value of the expression (which is usually an empty string) instead of the
     25  1.4  rillig # command that was executed.  It's strange that such a simple bug could
     26  1.4  rillig # survive such a long time.
     27  1.4  rillig .if ${:!echo word; false!} != "word"
     28  1.4  rillig .  error
     29  1.4  rillig .endif
     30  1.4  rillig .if ${:Uprevious value:!echo word; false!} != "word"
     31  1.4  rillig .  error
     32  1.4  rillig .endif
     33  1.4  rillig 
     34  1.1  rillig all:
     35  1.1  rillig 	@:;
     36