Module Name: src
Committed By: rillig
Date: Sun Nov 15 14:14:24 UTC 2020
Modified Files:
src/usr.bin/make/unit-tests: cond-op-not.exp cond-op-not.mk
Log Message:
make(1): add tests for the '!' operator in conditions
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/cond-op-not.exp
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cond-op-not.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-op-not.exp
diff -u src/usr.bin/make/unit-tests/cond-op-not.exp:1.1 src/usr.bin/make/unit-tests/cond-op-not.exp:1.2
--- src/usr.bin/make/unit-tests/cond-op-not.exp:1.1 Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/cond-op-not.exp Sun Nov 15 14:14:24 2020
@@ -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
Index: src/usr.bin/make/unit-tests/cond-op-not.mk
diff -u src/usr.bin/make/unit-tests/cond-op-not.mk:1.4 src/usr.bin/make/unit-tests/cond-op-not.mk:1.5
--- src/usr.bin/make/unit-tests/cond-op-not.mk:1.4 Sat Oct 24 08:46:08 2020
+++ src/usr.bin/make/unit-tests/cond-op-not.mk Sun Nov 15 14:14:24 2020
@@ -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:
@:;