Home | History | Annotate | Line # | Download | only in unit-tests
cmd-errors-lint.mk revision 1.5
      1 # $NetBSD: cmd-errors-lint.mk,v 1.5 2024/07/20 11:05:11 rillig Exp $
      2 #
      3 # Demonstrate how errors in expressions affect whether the commands
      4 # are actually executed.
      5 
      6 .MAKEFLAGS: -dL
      7 
      8 all: undefined unclosed-expression unclosed-modifier unknown-modifier end
      9 
     10 # Undefined variables in expressions are not an error.  They expand to empty
     11 # strings.
     12 undefined:
     13 # expect: : undefined
     14 	: $@ ${UNDEFINED}
     15 
     16 unclosed-expression:
     17 # expect: make: in target "unclosed-expression": Unclosed variable "UNCLOSED"
     18 # expect-not: : unclosed-expression
     19 	: $@ ${UNCLOSED
     20 
     21 unclosed-modifier:
     22 # expect: make: in target "unclosed-modifier": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}'
     23 # expect-not: : unclosed-modifier
     24 	: $@ ${UNCLOSED:
     25 
     26 unknown-modifier:
     27 # expect: make: in target "unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z"
     28 # expect-not: : unknown-modifier
     29 	: $@ ${UNKNOWN:Z}
     30 
     31 end:
     32 # expect: : end
     33 	: $@
     34 
     35 # expect: exit status 2
     36