Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make/unit-tests tests/make: add tests for ${...} wit...



details:   https://anonhg.NetBSD.org/src/rev/d457f76d5f72
branches:  trunk
changeset: 961934:d457f76d5f72
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Apr 25 21:05:38 2021 +0000

description:
tests/make: add tests for ${...} without operator in conditions

These tests are already covered in cond-cmp-unary.mk, but my first guess
was to search for these tests in cond-token-var.mk, so keep them in both
tests.

diffstat:

 usr.bin/make/unit-tests/cond-token-var.mk |  23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diffs (34 lines):

diff -r a6311deb78b1 -r d457f76d5f72 usr.bin/make/unit-tests/cond-token-var.mk
--- a/usr.bin/make/unit-tests/cond-token-var.mk Sun Apr 25 20:38:03 2021 +0000
+++ b/usr.bin/make/unit-tests/cond-token-var.mk Sun Apr 25 21:05:38 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: cond-token-var.mk,v 1.5 2020/11/15 14:58:14 rillig Exp $
+# $NetBSD: cond-token-var.mk,v 1.6 2021/04/25 21:05:38 rillig Exp $
 #
 # Tests for variable expressions in .if conditions.
 #
@@ -46,3 +46,24 @@
 # Since the expression is defined now, it doesn't generate any parse error.
 .if ${UNDEF:U}
 .endif
+
+# If the value of the variable expression is a number, it is compared against
+# zero.
+.if ${:U0}
+.  error
+.endif
+.if !${:U1}
+.  error
+.endif
+
+# If the value of the variable expression is not a number, any non-empty
+# value evaluates to true, even if there is only whitespace.
+.if ${:U}
+.  error
+.endif
+.if !${:U }
+.  error
+.endif
+.if !${:Uanything}
+.  error
+.endif



Home | Main Index | Thread Index | Old Index