Mon Nov 2 20:37:50 2020 UTC ()
make(1): add test for unclosed variable after a colon


(rillig)
diff -r1.1 -r1.2 src/usr.bin/make/unit-tests/cmd-errors.exp
diff -r1.1 -r1.2 src/usr.bin/make/unit-tests/cmd-errors.mk

cvs diff -r1.1 -r1.2 src/usr.bin/make/unit-tests/cmd-errors.exp (expand / switch to unified diff)

--- src/usr.bin/make/unit-tests/cmd-errors.exp 2020/11/02 20:20:42 1.1
+++ src/usr.bin/make/unit-tests/cmd-errors.exp 2020/11/02 20:37:50 1.2
@@ -1,6 +1,8 @@ @@ -1,6 +1,8 @@
1: undefined  1: undefined
2: unclosed  2make: Unclosed variable "UNCLOSED"
 3: unclosed-variable
 4: unclosed-modifier
3make: Unknown modifier 'Z' 5make: Unknown modifier 'Z'
4: unknown-modifier  6: unknown-modifier
5: end 7: end
6exit status 0 8exit status 0

cvs diff -r1.1 -r1.2 src/usr.bin/make/unit-tests/cmd-errors.mk (expand / switch to unified diff)

--- src/usr.bin/make/unit-tests/cmd-errors.mk 2020/11/02 20:20:42 1.1
+++ src/usr.bin/make/unit-tests/cmd-errors.mk 2020/11/02 20:37:50 1.2
@@ -1,24 +1,32 @@ @@ -1,24 +1,32 @@
1# $NetBSD: cmd-errors.mk,v 1.1 2020/11/02 20:20:42 rillig Exp $ 1# $NetBSD: cmd-errors.mk,v 1.2 2020/11/02 20:37:50 rillig Exp $
2# 2#
3# Demonstrate how errors in variable expansions affect whether the commands 3# Demonstrate how errors in variable expansions affect whether the commands
4# are actually executed. 4# are actually executed.
5 5
6all: undefined unclosed unknown-modifier end 6all: undefined unclosed-variable unclosed-modifier unknown-modifier end
7 7
8# Undefined variables are not an error. They expand to empty strings. 8# Undefined variables are not an error. They expand to empty strings.
9undefined: 9undefined:
10 : $@ ${UNDEFINED} 10 : $@ ${UNDEFINED}
11 11
12# XXX: As of 2020-11-01, this obvious syntax error is not detected. 12# XXX: As of 2020-11-01, this obvious syntax error is not detected.
13# XXX: As of 2020-11-01, this command is executed even though it contains 13# XXX: As of 2020-11-01, this command is executed even though it contains
14# parse errors. 14# parse errors.
15unclosed: 15unclosed-variable:
 16 : $@ ${UNCLOSED
 17
 18# XXX: As of 2020-11-01, this obvious syntax error is not detected.
 19# XXX: As of 2020-11-01, this command is executed even though it contains
 20# parse errors.
 21unclosed-modifier:
16 : $@ ${UNCLOSED: 22 : $@ ${UNCLOSED:
17 23
18# XXX: As of 2020-11-01, this command is executed even though it contains 24# XXX: As of 2020-11-01, this command is executed even though it contains
19# parse errors. 25# parse errors.
20unknown-modifier: 26unknown-modifier:
21 : $@ ${UNKNOWN:Z} 27 : $@ ${UNKNOWN:Z}
22 28
23end: 29end:
24 : $@ 30 : $@
 31
 32# XXX: As of 2020-11-02, despite the parse errors, the exit status is 0.