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 more tests for parsing ...



details:   https://anonhg.NetBSD.org/src/rev/7a6a5bacc54f
branches:  trunk
changeset: 947519:7a6a5bacc54f
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Dec 14 20:57:31 2020 +0000

description:
make(1): add more tests for parsing .endif

diffstat:

 usr.bin/make/unit-tests/directive-endif.exp |   5 ++++-
 usr.bin/make/unit-tests/directive-endif.mk  |  21 ++++++++++++++++++++-
 2 files changed, 24 insertions(+), 2 deletions(-)

diffs (43 lines):

diff -r 5570ff5e0fb1 -r 7a6a5bacc54f usr.bin/make/unit-tests/directive-endif.exp
--- a/usr.bin/make/unit-tests/directive-endif.exp       Mon Dec 14 20:39:35 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-endif.exp       Mon Dec 14 20:57:31 2020 +0000
@@ -1,1 +1,4 @@
-exit status 0
+make: "directive-endif.mk" line 42: Unknown directive "endifx"
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1
diff -r 5570ff5e0fb1 -r 7a6a5bacc54f usr.bin/make/unit-tests/directive-endif.mk
--- a/usr.bin/make/unit-tests/directive-endif.mk        Mon Dec 14 20:39:35 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-endif.mk        Mon Dec 14 20:57:31 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: directive-endif.mk,v 1.3 2020/11/12 22:40:11 rillig Exp $
+# $NetBSD: directive-endif.mk,v 1.4 2020/12/14 20:57:31 rillig Exp $
 #
 # Tests for the .endif directive.
 #
@@ -23,5 +23,24 @@
 .if 2
 .endif # comment
 
+# Only whitespace and comments are allowed after an '.endif', but nothing
+# else.
+# XXX: Missing error message
+.if 1
+.endif0
+
+# Only whitespace and comments are allowed after an '.endif', but nothing
+# else.
+# XXX: Missing error message
+.if 1
+.endif/
+
+# After an '.endif', no other letter must occur.  This 'endifx' is not
+# parsed as an 'endif', therefore another '.endif' must follow to balance
+# the directives.
+.if 1
+.endifx
+.endif # to close the preceding '.if'
+
 all:
        @:;



Home | Main Index | Thread Index | Old Index