xref: /freebsd/contrib/bmake/unit-tests/directive-endif.mk (revision cfd6422a5217410fbd66f7a7a8a64d9d85e61229)
1# $NetBSD: directive-endif.mk,v 1.5 2020/12/14 21:56:17 rillig Exp $
2#
3# Tests for the .endif directive.
4#
5# Since 2020-12-15, the .endif directive no longer accepts arguments.
6# The manual page had never allowed that, but the code didn't check it.
7#
8# See also:
9#	Cond_EvalLine
10
11# TODO: Implementation
12
13.MAKEFLAGS: -dL
14
15# Error: .endif does not take arguments
16.if 0
17# Since 2020-12-15, complain about the extra text after the 'endif'.
18.endif 0
19
20# Error: .endif does not take arguments
21.if 1
22# Since 2020-12-15, complain about the extra text after the 'endif'.
23.endif 1
24
25# Comments are allowed after an '.endif'.
26.if 2
27.endif # comment
28
29# Only whitespace and comments are allowed after an '.endif', but nothing
30# else.
31.if 1
32# Since 2020-12-15, complain about the extra text after the 'endif'.
33.endif0
34
35# Only whitespace and comments are allowed after an '.endif', but nothing
36# else.
37.if 1
38# Since 2020-12-15, complain about the extra text after the 'endif'.
39.endif/
40
41# After an '.endif', no other letter must occur.  This 'endifx' is not
42# parsed as an 'endif', therefore another '.endif' must follow to balance
43# the directives.
44.if 1
45.endifx
46.endif # to close the preceding '.if'
47
48all:
49	@:;
50