From 2bf1c0cbcfc08646c180c3ebb5bbac027940942e Mon Sep 17 00:00:00 2001 From: rillig Date: Sun, 25 Apr 2021 21:05:38 +0000 Subject: [PATCH] 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. --- usr.bin/make/unit-tests/cond-token-var.mk | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/usr.bin/make/unit-tests/cond-token-var.mk b/usr.bin/make/unit-tests/cond-token-var.mk index 30eba87ad4d2..168c63c46ac1 100644 --- a/usr.bin/make/unit-tests/cond-token-var.mk +++ b/usr.bin/make/unit-tests/cond-token-var.mk @@ -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