1# $NetBSD: directive-else.mk,v 1.7 2020/12/14 22:17:11 rillig Exp $
2#
3# Tests for the .else directive.
4#
5# Since 2020-11-13, an '.else' followed by extraneous text generates a parse
6# error in -dL (lint) mode.
7#
8# Since 2020-12-15, an '.else' followed by extraneous text always generates
9# a parse error.
10
11.if 0
12.  warning must not be reached
13# The .else directive does not take any arguments.
14.else 123
15.  info ok
16.endif
17
18.if 1
19.  info ok
20# The .else directive does not take any arguments.
21.else 123
22.  warning must not be reached
23.endif
24
25# An .else without a corresponding .if is an error.
26.else
27
28# Accidental extra .else directives are detected too.
29.if 0
30.  warning must not be reached
31.else
32.  info ok
33.else
34.  info After an extra .else, everything is skipped.
35.endif
36
37# An .else may have a comment.  This comment does not count as an argument,
38# therefore no parse error.
39.if 0
40.else # comment
41.endif
42
43# A variable expression does count as an argument, even if it is empty.
44.if 0
45.else ${:U}
46.endif
47
48all:
49	@:;
50