summaryrefslogtreecommitdiff
path: root/unit-tests/cond-token-number.mk
diff options
context:
space:
mode:
Diffstat (limited to 'unit-tests/cond-token-number.mk')
-rw-r--r--unit-tests/cond-token-number.mk56
1 files changed, 52 insertions, 4 deletions
diff --git a/unit-tests/cond-token-number.mk b/unit-tests/cond-token-number.mk
index 30e7e84e81bb..4171a07d56c6 100644
--- a/unit-tests/cond-token-number.mk
+++ b/unit-tests/cond-token-number.mk
@@ -1,8 +1,56 @@
-# $NetBSD: cond-token-number.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: cond-token-number.mk,v 1.3 2020/09/14 06:22:59 rillig Exp $
#
# Tests for number tokens in .if conditions.
-# TODO: Implementation
+.if 0
+. error
+.endif
-all:
- @:;
+# Even though -0 is a number and would be accepted by strtod, it is not
+# accepted by the condition parser.
+#
+# See the ch_isdigit call in CondParser_String.
+.if -0
+. error
+.endif
+
+# Even though +0 is a number and would be accepted by strtod, it is not
+# accepted by the condition parser.
+#
+# See the ch_isdigit call in CondParser_String.
+.if +0
+. error
+.endif
+
+# Even though -1 is a number and would be accepted by strtod, it is not
+# accepted by the condition parser.
+#
+# See the ch_isdigit call in CondParser_String.
+.if !-1
+. error
+.endif
+
+# Even though +1 is a number and would be accepted by strtod, it is not
+# accepted by the condition parser.
+#
+# See the ch_isdigit call in CondParser_String.
+.if !+1
+. error
+.endif
+
+# When the number comes from a variable expression though, it may be signed.
+# XXX: This is inconsistent.
+.if ${:U+0}
+. error
+.endif
+
+# When the number comes from a variable expression though, it may be signed.
+# XXX: This is inconsistent.
+.if !${:U+1}
+. error
+.endif
+
+# Ensure that parsing continues until here.
+.info End of the tests.
+
+all: # nothing