diff options
Diffstat (limited to 'unit-tests/cond-op-not.mk')
-rw-r--r-- | unit-tests/cond-op-not.mk | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/unit-tests/cond-op-not.mk b/unit-tests/cond-op-not.mk index d929318785a5..388c62d8898f 100644 --- a/unit-tests/cond-op-not.mk +++ b/unit-tests/cond-op-not.mk @@ -1,6 +1,6 @@ -# $NetBSD: cond-op-not.mk,v 1.4 2020/10/24 08:46:08 rillig Exp $ +# $NetBSD: cond-op-not.mk,v 1.6 2020/11/15 14:58:14 rillig Exp $ # -# Tests for the ! operator in .if conditions. +# Tests for the ! operator in .if conditions, which negates its argument. # The exclamation mark negates its operand. .if !1 @@ -18,5 +18,42 @@ . error .endif +# The operator '==' binds more tightly than '!'. +# This is unusual since most other programming languages define the precedence +# to be the other way round. +.if !${:Uexpression} == "expression" +. error +.endif + +.if !${:U} +. info Not empty evaluates to true. +.else +. info Not empty evaluates to false. +.endif + +.if !${:U } +. info Not space evaluates to true. +.else +. info Not space evaluates to false. +.endif + +.if !${:U0} +. info Not 0 evaluates to true. +.else +. info Not 0 evaluates to false. +.endif + +.if !${:U1} +. info Not 1 evaluates to true. +.else +. info Not 1 evaluates to false. +.endif + +.if !${:Uword} +. info Not word evaluates to true. +.else +. info Not word evaluates to false. +.endif + all: @:; |