directive-if.mk revision 1.3
1# $NetBSD: directive-if.mk,v 1.3 2020/11/10 20:44:18 rillig Exp $
2#
3# Tests for the .if directive.
4
5# TODO: Implementation
6
7.if 0
8.  error
9.else
10.  info 0 evaluates to false.
11.endif
12
13.if 1
14.  info 1 evaluates to true.
15.else
16.  error
17.endif
18
19# There is no '.ifx'.
20#
21# The commit from 2005-05-01 intended to detect this situation, but it failed
22# to do this since the call to is_token has its arguments switched.  They are
23# expected as (str, token, token_len) but are actually passed as (token, str,
24# token_len).  This made is_token return true even if the directive was
25# directly followed by alphanumerical characters.
26#
27# Back at that time, the commits only modified the main code but did not add
28# the corresponding unit tests.  This allowed the bug to hide for more than
29# 15 years.
30.ifx 123
31.  error
32.else
33.  error
34.endif
35
36# Missing condition.
37.if
38.  error
39.else
40.  error
41.endif
42
43all:
44