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

This commit is contained in:
rillig 2020-12-14 20:57:31 +00:00
parent fa6ec3776b
commit 1eeb87db64
2 changed files with 24 additions and 2 deletions

View File

@ -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

View File

@ -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:
@:;