summaryrefslogtreecommitdiff
path: root/unit-tests/cond-cmp-unary.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-cmp-unary.mk
parent302da1a3d35c15cb29d76e0a939f8bcb13f7ad80 (diff)
downloadsrc-test2-vendor/NetBSD/bmake/20201117.tar.gz
src-test2-vendor/NetBSD/bmake/20201117.zip
Diffstat (limited to 'unit-tests/cond-cmp-unary.mk')
-rwxr-xr-xunit-tests/cond-cmp-unary.mk17
1 files changed, 16 insertions, 1 deletions
diff --git a/unit-tests/cond-cmp-unary.mk b/unit-tests/cond-cmp-unary.mk
index 88ce79bf1a99..168de0f30e3f 100755
--- a/unit-tests/cond-cmp-unary.mk
+++ b/unit-tests/cond-cmp-unary.mk
@@ -1,4 +1,4 @@
-# $NetBSD: cond-cmp-unary.mk,v 1.1 2020/09/14 06:22:59 rillig Exp $
+# $NetBSD: cond-cmp-unary.mk,v 1.2 2020/11/11 07:30:11 rillig Exp $
#
# Tests for unary comparisons in .if conditions, that is, comparisons with
# a single operand. If the operand is a number, it is compared to zero,
@@ -25,6 +25,9 @@
.endif
# The empty string may come from a variable expression.
+#
+# XXX: As of 2020-11-11, this empty string is interpreted "as a number" in
+# EvalNotEmpty, which is plain wrong. The bug is in TryParseNumber.
.if ${:U}
. error
.endif
@@ -40,4 +43,16 @@
. error
.endif
+# A string of whitespace should evaluate to false.
+#
+# XXX: As of 2020-11-11, the implementation in EvalNotEmpty does not skip
+# whitespace before testing for the end. This was probably an oversight in
+# a commit from 1992-04-15 saying "A variable is empty when it just contains
+# spaces".
+.if ${:U }
+. info This is only reached because of a bug in EvalNotEmpty.
+.else
+. error
+.endif
+
all: # nothing