Module Name: src
Committed By: rillig
Date: Thu Sep 10 22:44:08 UTC 2020
Modified Files:
src/usr.bin/make/unit-tests: cond-op-or.exp cond-op-or.mk
Log Message:
make(1): add tests for the |, ||, ||| operators
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/cond-op-or.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cond-op-or.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-or.exp
diff -u src/usr.bin/make/unit-tests/cond-op-or.exp:1.1 src/usr.bin/make/unit-tests/cond-op-or.exp:1.2
--- src/usr.bin/make/unit-tests/cond-op-or.exp:1.1 Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/cond-op-or.exp Thu Sep 10 22:44:08 2020
@@ -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
Index: src/usr.bin/make/unit-tests/cond-op-or.mk
diff -u src/usr.bin/make/unit-tests/cond-op-or.mk:1.3 src/usr.bin/make/unit-tests/cond-op-or.mk:1.4
--- src/usr.bin/make/unit-tests/cond-op-or.mk:1.3 Fri Aug 28 14:48:37 2020
+++ src/usr.bin/make/unit-tests/cond-op-or.mk Thu Sep 10 22:44:08 2020
@@ -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:
@:;