Module Name:    src
Committed By:   rillig
Date:           Thu Sep 10 22:38:58 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: cond-op-and.exp cond-op-and.mk

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


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/cond-op-and.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cond-op-and.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-and.exp
diff -u src/usr.bin/make/unit-tests/cond-op-and.exp:1.1 src/usr.bin/make/unit-tests/cond-op-and.exp:1.2
--- src/usr.bin/make/unit-tests/cond-op-and.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/cond-op-and.exp	Thu Sep 10 22:38:57 2020
@@ -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

Index: src/usr.bin/make/unit-tests/cond-op-and.mk
diff -u src/usr.bin/make/unit-tests/cond-op-and.mk:1.3 src/usr.bin/make/unit-tests/cond-op-and.mk:1.4
--- src/usr.bin/make/unit-tests/cond-op-and.mk:1.3	Fri Aug 28 14:48:37 2020
+++ src/usr.bin/make/unit-tests/cond-op-and.mk	Thu Sep 10 22:38:57 2020
@@ -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:
 	@:;

Reply via email to