Module Name:    src
Committed By:   rillig
Date:           Mon Dec 14 20:57:32 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: directive-endif.exp directive-endif.mk

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


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/directive-endif.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/directive-endif.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/directive-endif.exp
diff -u src/usr.bin/make/unit-tests/directive-endif.exp:1.1 src/usr.bin/make/unit-tests/directive-endif.exp:1.2
--- src/usr.bin/make/unit-tests/directive-endif.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/directive-endif.exp	Mon Dec 14 20:57:31 2020
@@ -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

Index: src/usr.bin/make/unit-tests/directive-endif.mk
diff -u src/usr.bin/make/unit-tests/directive-endif.mk:1.3 src/usr.bin/make/unit-tests/directive-endif.mk:1.4
--- src/usr.bin/make/unit-tests/directive-endif.mk:1.3	Thu Nov 12 22:40:11 2020
+++ src/usr.bin/make/unit-tests/directive-endif.mk	Mon Dec 14 20:57:31 2020
@@ -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:
 	@:;

Reply via email to