aboutsummaryrefslogtreecommitdiff
path: root/unit-tests/cond-token-number.mk
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2020-11-20 03:54:37 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2020-11-20 03:54:37 +0000
commit1b65f0bd2bda7121a90f8cb4c1cacaa20f1b681d (patch)
tree90c374b8513ec5109e1ec4e2228e2edf648e8756 /unit-tests/cond-token-number.mk
parent302da1a3d35c15cb29d76e0a939f8bcb13f7ad80 (diff)
downloadsrc-1b65f0bd2bda7121a90f8cb4c1cacaa20f1b681d.tar.gz
src-1b65f0bd2bda7121a90f8cb4c1cacaa20f1b681d.zip
Notes
Diffstat (limited to 'unit-tests/cond-token-number.mk')
-rw-r--r--unit-tests/cond-token-number.mk28
1 files changed, 27 insertions, 1 deletions
diff --git a/unit-tests/cond-token-number.mk b/unit-tests/cond-token-number.mk
index 4171a07d56c6..93e2646a60eb 100644
--- a/unit-tests/cond-token-number.mk
+++ b/unit-tests/cond-token-number.mk
@@ -1,6 +1,8 @@
-# $NetBSD: cond-token-number.mk,v 1.3 2020/09/14 06:22:59 rillig Exp $
+# $NetBSD: cond-token-number.mk,v 1.5 2020/11/15 14:58:14 rillig Exp $
#
# Tests for number tokens in .if conditions.
+#
+# TODO: Add introduction.
.if 0
. error
@@ -12,6 +14,8 @@
# See the ch_isdigit call in CondParser_String.
.if -0
. error
+.else
+. error
.endif
# Even though +0 is a number and would be accepted by strtod, it is not
@@ -20,6 +24,8 @@
# See the ch_isdigit call in CondParser_String.
.if +0
. error
+.else
+. error
.endif
# Even though -1 is a number and would be accepted by strtod, it is not
@@ -28,6 +34,8 @@
# See the ch_isdigit call in CondParser_String.
.if !-1
. error
+.else
+. error
.endif
# Even though +1 is a number and would be accepted by strtod, it is not
@@ -36,6 +44,8 @@
# See the ch_isdigit call in CondParser_String.
.if !+1
. error
+.else
+. error
.endif
# When the number comes from a variable expression though, it may be signed.
@@ -50,6 +60,22 @@
. error
.endif
+# Hexadecimal numbers are accepted.
+.if 0x0
+. error
+.endif
+.if 0x1
+.else
+. error
+.endif
+
+# This is not a hexadecimal number, even though it has an x.
+# It is interpreted as a string instead, effectively meaning defined(3x4).
+.if 3x4
+.else
+. error
+.endif
+
# Ensure that parsing continues until here.
.info End of the tests.