]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/bmake/unit-tests/directive-else.mk
Merge bmake-20201117
[FreeBSD/FreeBSD.git] / contrib / bmake / unit-tests / directive-else.mk
1 # $NetBSD: directive-else.mk,v 1.6 2020/11/13 09:01:59 rillig Exp $
2 #
3 # Tests for the .else directive.
4
5 .MAKEFLAGS: -dL                 # To enable the check for ".else <cond>"
6
7 # The .else directive does not take any arguments.
8 # As of 2020-08-29, make doesn't warn about this.
9 .if 0
10 .  warning must not be reached
11 .else 123
12 .  info ok
13 .endif
14
15 .if 1
16 .  info ok
17 .else 123
18 .  warning must not be reached
19 .endif
20
21 # An .else without a corresponding .if is an error.
22 .else
23
24 # Accidental extra .else directives are detected too.
25 .if 0
26 .  warning must not be reached
27 .else
28 .  info ok
29 .else
30 .  info After an extra .else, everything is skipped.
31 .endif
32
33 # An .else may have a comment.  This comment does not count as an argument,
34 # therefore no parse error.
35 .if 0
36 .else # comment
37 .endif
38
39 # A variable expression does count as an argument, even if it is empty.
40 # XXX: This should be a parse error.
41 .if 0
42 .else ${:U}
43 .endif
44
45 all:
46         @:;