xref: /freebsd/contrib/bmake/unit-tests/cond-token-number.mk (revision a521f2116473fbd8c09db395518f060a27d02334)
1# $NetBSD: cond-token-number.mk,v 1.3 2020/09/14 06:22:59 rillig Exp $
2#
3# Tests for number tokens in .if conditions.
4
5.if 0
6.  error
7.endif
8
9# Even though -0 is a number and would be accepted by strtod, it is not
10# accepted by the condition parser.
11#
12# See the ch_isdigit call in CondParser_String.
13.if -0
14.  error
15.endif
16
17# Even though +0 is a number and would be accepted by strtod, it is not
18# accepted by the condition parser.
19#
20# See the ch_isdigit call in CondParser_String.
21.if +0
22.  error
23.endif
24
25# Even though -1 is a number and would be accepted by strtod, it is not
26# accepted by the condition parser.
27#
28# See the ch_isdigit call in CondParser_String.
29.if !-1
30.  error
31.endif
32
33# Even though +1 is a number and would be accepted by strtod, it is not
34# accepted by the condition parser.
35#
36# See the ch_isdigit call in CondParser_String.
37.if !+1
38.  error
39.endif
40
41# When the number comes from a variable expression though, it may be signed.
42# XXX: This is inconsistent.
43.if ${:U+0}
44.  error
45.endif
46
47# When the number comes from a variable expression though, it may be signed.
48# XXX: This is inconsistent.
49.if !${:U+1}
50.  error
51.endif
52
53# Ensure that parsing continues until here.
54.info End of the tests.
55
56all: # nothing
57