xref: /freebsd/contrib/bmake/unit-tests/cmd-errors.mk (revision 759b177aecbfc49ebc900739954ac56b1aa5fc53)
1*759b177aSSimon J. Gerraty# $NetBSD: cmd-errors.mk,v 1.12 2025/03/29 19:08:52 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:
1122619282SSimon J. Gerraty# expect: : undefined--eol
124fde40d9SSimon J. Gerraty	: $@-${UNDEFINED}-eol
13e2eeea75SSimon J. Gerraty
14548bfc56SSimon J. Gerratyunclosed-expression:
156a7405f5SSimon J. Gerraty# expect: make: Unclosed variable "UNCLOSED"
166a7405f5SSimon J. Gerraty# expect-not: : unclosed-expression-
174fde40d9SSimon J. Gerraty	: $@-${UNCLOSED
18e2eeea75SSimon J. Gerraty
19e2eeea75SSimon J. Gerratyunclosed-modifier:
206a7405f5SSimon J. Gerraty# expect: make: Unclosed expression, expecting '}'
216a7405f5SSimon J. Gerraty# expect-not: : unclosed-modifier-
224fde40d9SSimon J. Gerraty	: $@-${UNCLOSED:
23e2eeea75SSimon J. Gerraty
24e2eeea75SSimon J. Gerratyunknown-modifier:
25*759b177aSSimon J. Gerraty# expect: make: Unknown modifier ":Z"
266a7405f5SSimon J. Gerraty# expect-not: : unknown-modifier--eol
274fde40d9SSimon J. Gerraty	: $@-${UNKNOWN:Z}-eol
28e2eeea75SSimon J. Gerraty
29e2eeea75SSimon J. Gerratyend:
3022619282SSimon J. Gerraty# expect: : end-eol
314fde40d9SSimon J. Gerraty	: $@-eol
32e2eeea75SSimon J. Gerraty
3322619282SSimon J. Gerraty# expect: exit status 2
34