xref: /freebsd/contrib/bmake/unit-tests/cmd-errors-lint.mk (revision 3750ccefb8629a08890bfbae894dd6bc6a7483b4)
1# $NetBSD: cmd-errors-lint.mk,v 1.4 2024/07/05 18:59:33 rillig Exp $
2#
3# Demonstrate how errors in expressions affect whether the commands
4# are actually executed.
5
6.MAKEFLAGS: -dL
7
8all: undefined unclosed-expression unclosed-modifier unknown-modifier end
9
10# Undefined variables in expressions are not an error.  They expand to empty
11# strings.
12undefined:
13# expect: : undefined
14	: $@ ${UNDEFINED}
15
16unclosed-expression:
17# expect: make: in target "unclosed-expression": Unclosed variable "UNCLOSED"
18# XXX: This command is executed even though it contains parse errors.
19# expect: : unclosed-expression
20	: $@ ${UNCLOSED
21
22unclosed-modifier:
23# expect: make: in target "unclosed-modifier": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}'
24# XXX: This command is executed even though it contains parse errors.
25# expect: : unclosed-modifier
26	: $@ ${UNCLOSED:
27
28unknown-modifier:
29# expect: make: in target "unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z"
30# XXX: This command is executed even though it contains parse errors.
31# expect: : unknown-modifier
32	: $@ ${UNKNOWN:Z}
33
34end:
35# expect: : end
36	: $@
37
38# expect: exit status 2
39