From 1eeb87db649663de759896881c6bb100ed9daba6 Mon Sep 17 00:00:00 2001 From: rillig Date: Mon, 14 Dec 2020 20:57:31 +0000 Subject: [PATCH] make(1): add more tests for parsing .endif --- 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(-) diff --git a/usr.bin/make/unit-tests/directive-endif.exp b/usr.bin/make/unit-tests/directive-endif.exp index 39a9383953dd..0dd23a54e9e8 100644 --- a/usr.bin/make/unit-tests/directive-endif.exp +++ b/usr.bin/make/unit-tests/directive-endif.exp @@ -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 --git a/usr.bin/make/unit-tests/directive-endif.mk b/usr.bin/make/unit-tests/directive-endif.mk index b0b531af2f06..6e7f4304bf66 100644 --- a/usr.bin/make/unit-tests/directive-endif.mk +++ b/usr.bin/make/unit-tests/directive-endif.mk @@ -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: @:;