xref: /freebsd/contrib/bmake/unit-tests/cmd-errors.mk (revision 6a7405f5a6b639682cacf01e35d561411ff556aa)
1*6a7405f5SSimon J. Gerraty# $NetBSD: cmd-errors.mk,v 1.11 2024/08/29 20:20:35 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:
15*6a7405f5SSimon J. Gerraty# expect: make: Unclosed variable "UNCLOSED"
16*6a7405f5SSimon J. Gerraty# expect-not: : unclosed-expression-
174fde40d9SSimon J. Gerraty	: $@-${UNCLOSED
18e2eeea75SSimon J. Gerraty
19e2eeea75SSimon J. Gerratyunclosed-modifier:
20*6a7405f5SSimon J. Gerraty# expect: make: Unclosed expression, expecting '}'
21*6a7405f5SSimon J. Gerraty# expect-not: : unclosed-modifier-
224fde40d9SSimon J. Gerraty	: $@-${UNCLOSED:
23e2eeea75SSimon J. Gerraty
24e2eeea75SSimon J. Gerratyunknown-modifier:
25*6a7405f5SSimon J. Gerraty# expect: make: Unknown modifier "Z"
26*6a7405f5SSimon 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