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 test for the &, && and ...



details:   https://anonhg.NetBSD.org/src/rev/3704c92e3167
branches:  trunk
changeset: 975993:3704c92e3167
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Sep 10 22:38:57 2020 +0000

description:
make(1): add test for the &, && and &&& operators

diffstat:

 usr.bin/make/unit-tests/cond-op-and.exp |   5 ++++-
 usr.bin/make/unit-tests/cond-op-and.mk  |  23 ++++++++++++++++++++++-
 2 files changed, 26 insertions(+), 2 deletions(-)

diffs (45 lines):

diff -r 7107aceeb1cf -r 3704c92e3167 usr.bin/make/unit-tests/cond-op-and.exp
--- a/usr.bin/make/unit-tests/cond-op-and.exp   Thu Sep 10 21:40:50 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-op-and.exp   Thu Sep 10 22:38:57 2020 +0000
@@ -1,1 +1,4 @@
-exit status 0
+make: "cond-op-and.mk" line 43: Malformed conditional (0 &&& 0)
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1
diff -r 7107aceeb1cf -r 3704c92e3167 usr.bin/make/unit-tests/cond-op-and.mk
--- a/usr.bin/make/unit-tests/cond-op-and.mk    Thu Sep 10 21:40:50 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-op-and.mk    Thu Sep 10 22:38:57 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: cond-op-and.mk,v 1.3 2020/08/28 14:48:37 rillig Exp $
+# $NetBSD: cond-op-and.mk,v 1.4 2020/09/10 22:38:57 rillig Exp $
 #
 # Tests for the && operator in .if conditions.
 
@@ -23,5 +23,26 @@
 .if 0 && ${UNDEF}
 .endif
 
+# The && operator may be abbreviated as &.  This is not widely known though
+# and is also not documented in the manual page.
+
+.if 0 & 0
+.  error
+.endif
+.if 1 & 0
+.  error
+.endif
+.if 0 & 1
+.  error
+.endif
+.if !(1 & 1)
+.  error
+.endif
+
+# There is no operator &&&.
+.if 0 &&& 0
+.  error
+.endif
+
 all:
        @:;



Home | Main Index | Thread Index | Old Index