Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make/unit-tests make(1): add test for unclosed varia...



details:   https://anonhg.NetBSD.org/src/rev/0c9770829b7b
branches:  trunk
changeset: 977844:0c9770829b7b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Nov 02 20:37:50 2020 +0000

description:
make(1): add test for unclosed variable after a colon

diffstat:

 usr.bin/make/unit-tests/cmd-errors.exp |   4 +++-
 usr.bin/make/unit-tests/cmd-errors.mk  |  14 +++++++++++---
 2 files changed, 14 insertions(+), 4 deletions(-)

diffs (48 lines):

diff -r 23b0291f06c2 -r 0c9770829b7b usr.bin/make/unit-tests/cmd-errors.exp
--- a/usr.bin/make/unit-tests/cmd-errors.exp    Mon Nov 02 20:20:42 2020 +0000
+++ b/usr.bin/make/unit-tests/cmd-errors.exp    Mon Nov 02 20:37:50 2020 +0000
@@ -1,5 +1,7 @@
 : undefined 
-: unclosed 
+make: Unclosed variable "UNCLOSED"
+: unclosed-variable 
+: unclosed-modifier 
 make: Unknown modifier 'Z'
 : unknown-modifier 
 : end
diff -r 23b0291f06c2 -r 0c9770829b7b usr.bin/make/unit-tests/cmd-errors.mk
--- a/usr.bin/make/unit-tests/cmd-errors.mk     Mon Nov 02 20:20:42 2020 +0000
+++ b/usr.bin/make/unit-tests/cmd-errors.mk     Mon Nov 02 20:37:50 2020 +0000
@@ -1,9 +1,9 @@
-# $NetBSD: cmd-errors.mk,v 1.1 2020/11/02 20:20:42 rillig Exp $
+# $NetBSD: cmd-errors.mk,v 1.2 2020/11/02 20:37:50 rillig Exp $
 #
 # Demonstrate how errors in variable expansions affect whether the commands
 # are actually executed.
 
-all: undefined unclosed unknown-modifier end
+all: undefined unclosed-variable unclosed-modifier unknown-modifier end
 
 # Undefined variables are not an error.  They expand to empty strings.
 undefined:
@@ -12,7 +12,13 @@
 # XXX: As of 2020-11-01, this obvious syntax error is not detected.
 # XXX: As of 2020-11-01, this command is executed even though it contains
 # parse errors.
-unclosed:
+unclosed-variable:
+       : $@ ${UNCLOSED
+
+# XXX: As of 2020-11-01, this obvious syntax error is not detected.
+# XXX: As of 2020-11-01, this command is executed even though it contains
+# parse errors.
+unclosed-modifier:
        : $@ ${UNCLOSED:
 
 # XXX: As of 2020-11-01, this command is executed even though it contains
@@ -22,3 +28,5 @@
 
 end:
        : $@
+
+# XXX: As of 2020-11-02, despite the parse errors, the exit status is 0.



Home | Main Index | Thread Index | Old Index