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 |, ||, ||...



details:   https://anonhg.NetBSD.org/src/rev/e9e235c44652
branches:  trunk
changeset: 938538:e9e235c44652
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Sep 10 22:44:08 2020 +0000

description:
make(1): add tests for the |, ||, ||| operators

diffstat:

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

diffs (45 lines):

diff -r e15930fd1a66 -r e9e235c44652 usr.bin/make/unit-tests/cond-op-or.exp
--- a/usr.bin/make/unit-tests/cond-op-or.exp    Thu Sep 10 22:38:57 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-op-or.exp    Thu Sep 10 22:44:08 2020 +0000
@@ -1,1 +1,4 @@
-exit status 0
+make: "cond-op-or.mk" line 43: Malformed conditional (0 ||| 0)
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1
diff -r e15930fd1a66 -r e9e235c44652 usr.bin/make/unit-tests/cond-op-or.mk
--- a/usr.bin/make/unit-tests/cond-op-or.mk     Thu Sep 10 22:38:57 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-op-or.mk     Thu Sep 10 22:44:08 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: cond-op-or.mk,v 1.3 2020/08/28 14:48:37 rillig Exp $
+# $NetBSD: cond-op-or.mk,v 1.4 2020/09/10 22:44:08 rillig Exp $
 #
 # Tests for the || operator in .if conditions.
 
@@ -23,5 +23,26 @@
 .if 1 || ${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