xref: /freebsd/contrib/bmake/unit-tests/cmd-errors.mk (revision 226192822cddc30cacecd55bccb48f39c653058c)
1*22619282SSimon J. Gerraty# $NetBSD: cmd-errors.mk,v 1.9 2024/07/09 19:43:01 rillig Exp $
2e2eeea75SSimon J. Gerraty#
3548bfc56SSimon J. Gerraty# Demonstrate how errors in expressions affect whether the commands
406b9b3e0SSimon J. Gerraty# are actually executed in compat mode.
5e2eeea75SSimon J. Gerraty
6548bfc56SSimon J. Gerratyall: undefined unclosed-expression unclosed-modifier unknown-modifier end
7e2eeea75SSimon J. Gerraty
8548bfc56SSimon J. Gerraty# Undefined variables in expressions are not an error.  They expand to empty
9548bfc56SSimon J. Gerraty# strings.
10e2eeea75SSimon J. Gerratyundefined:
11*22619282SSimon J. Gerraty# expect: : undefined--eol
124fde40d9SSimon J. Gerraty	: $@-${UNDEFINED}-eol
13e2eeea75SSimon J. Gerraty
14548bfc56SSimon J. Gerratyunclosed-expression:
15*22619282SSimon J. Gerraty# expect: make: in target "unclosed-expression": Unclosed variable "UNCLOSED"
16*22619282SSimon J. Gerraty# XXX: This command is executed even though it contains parse errors.
17*22619282SSimon J. Gerraty# expect: : unclosed-expression-
184fde40d9SSimon J. Gerraty	: $@-${UNCLOSED
19e2eeea75SSimon J. Gerraty
20e2eeea75SSimon J. Gerratyunclosed-modifier:
21*22619282SSimon J. Gerraty# expect: make: in target "unclosed-modifier": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}'
22*22619282SSimon J. Gerraty# XXX: This command is executed even though it contains parse errors.
23*22619282SSimon J. Gerraty# expect: : unclosed-modifier-
244fde40d9SSimon J. Gerraty	: $@-${UNCLOSED:
25e2eeea75SSimon J. Gerraty
26e2eeea75SSimon J. Gerratyunknown-modifier:
27*22619282SSimon J. Gerraty# expect: make: in target "unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z"
28*22619282SSimon J. Gerraty# XXX: This command is executed even though it contains parse errors.
29*22619282SSimon J. Gerraty# expect: : unknown-modifier--eol
304fde40d9SSimon J. Gerraty	: $@-${UNKNOWN:Z}-eol
31e2eeea75SSimon J. Gerraty
32e2eeea75SSimon J. Gerratyend:
33*22619282SSimon J. Gerraty# expect: : end-eol
344fde40d9SSimon J. Gerraty	: $@-eol
35e2eeea75SSimon J. Gerraty
36*22619282SSimon J. Gerraty# expect: exit status 2
37