Module Name:    src
Committed By:   rillig
Date:           Sun Apr 25 21:05:38 UTC 2021

Modified Files:
        src/usr.bin/make/unit-tests: cond-token-var.mk

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cond-token-var.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/cond-token-var.mk
diff -u src/usr.bin/make/unit-tests/cond-token-var.mk:1.5 src/usr.bin/make/unit-tests/cond-token-var.mk:1.6
--- src/usr.bin/make/unit-tests/cond-token-var.mk:1.5	Sun Nov 15 14:58:14 2020
+++ src/usr.bin/make/unit-tests/cond-token-var.mk	Sun Apr 25 21:05:38 2021
@@ -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 @@ DEF=	defined
 # 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

Reply via email to