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 make(1): add tests for the '!' opera...



details:   https://anonhg.NetBSD.org/src/rev/0f082e7724ea
branches:  trunk
changeset: 957066:0f082e7724ea
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Nov 15 14:14:24 2020 +0000

description:
make(1): add tests for the '!' operator in conditions

diffstat:

 usr.bin/make/unit-tests/cond-op-not.exp |   5 ++++
 usr.bin/make/unit-tests/cond-op-not.mk  |  39 +++++++++++++++++++++++++++++++-
 2 files changed, 42 insertions(+), 2 deletions(-)

diffs (63 lines):

diff -r 2cdf942d94eb -r 0f082e7724ea usr.bin/make/unit-tests/cond-op-not.exp
--- a/usr.bin/make/unit-tests/cond-op-not.exp   Sun Nov 15 14:07:53 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-op-not.exp   Sun Nov 15 14:14:24 2020 +0000
@@ -1,1 +1,6 @@
+make: "cond-op-not.mk" line 27: Not empty evaluates to true.
+make: "cond-op-not.mk" line 35: Not space evaluates to false.
+make: "cond-op-not.mk" line 39: Not 0 evaluates to true.
+make: "cond-op-not.mk" line 47: Not 1 evaluates to false.
+make: "cond-op-not.mk" line 53: Not word evaluates to false.
 exit status 0
diff -r 2cdf942d94eb -r 0f082e7724ea usr.bin/make/unit-tests/cond-op-not.mk
--- a/usr.bin/make/unit-tests/cond-op-not.mk    Sun Nov 15 14:07:53 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-op-not.mk    Sun Nov 15 14:14:24 2020 +0000
@@ -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.5 2020/11/15 14:14:24 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,40 @@
 .  error
 .endif
 
+# The '==' binds more tightly than '!'.
+.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:
        @:;



Home | Main Index | Thread Index | Old Index