Module Name:    src
Committed By:   rillig
Date:           Tue Aug 15 21:27:09 UTC 2023

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

Log Message:
tests/make: show that '||' and '&&' must be preceded by whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/cond-op-and.mk
cvs rdiff -u -r1.9 -r1.10 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-and.mk
diff -u src/usr.bin/make/unit-tests/cond-op-and.mk:1.7 src/usr.bin/make/unit-tests/cond-op-and.mk:1.8
--- src/usr.bin/make/unit-tests/cond-op-and.mk:1.7	Thu Jun  1 20:56:35 2023
+++ src/usr.bin/make/unit-tests/cond-op-and.mk	Tue Aug 15 21:27:09 2023
@@ -1,4 +1,4 @@
-# $NetBSD: cond-op-and.mk,v 1.7 2023/06/01 20:56:35 rillig Exp $
+# $NetBSD: cond-op-and.mk,v 1.8 2023/08/15 21:27:09 rillig Exp $
 #
 # Tests for the && operator in .if conditions.
 
@@ -76,5 +76,9 @@ DEF=	defined
 .  error
 .endif
 
-all:
-	@:;
+# The '&&' operator must be preceded by whitespace, otherwise it becomes part
+# of the preceding bare word.  The condition is parsed as '"1&&" != "" && 1'.
+.if 1&& && 1
+.else
+.  error
+.endif

Index: src/usr.bin/make/unit-tests/cond-op-or.mk
diff -u src/usr.bin/make/unit-tests/cond-op-or.mk:1.9 src/usr.bin/make/unit-tests/cond-op-or.mk:1.10
--- src/usr.bin/make/unit-tests/cond-op-or.mk:1.9	Thu Jun  1 20:56:35 2023
+++ src/usr.bin/make/unit-tests/cond-op-or.mk	Tue Aug 15 21:27:09 2023
@@ -1,4 +1,4 @@
-# $NetBSD: cond-op-or.mk,v 1.9 2023/06/01 20:56:35 rillig Exp $
+# $NetBSD: cond-op-or.mk,v 1.10 2023/08/15 21:27:09 rillig Exp $
 #
 # Tests for the || operator in .if conditions.
 
@@ -76,5 +76,9 @@ DEF=	defined
 .  error
 .endif
 
-all:
-	@:;
+# The '||' operator must be preceded by whitespace, otherwise it becomes part
+# of the preceding bare word.  The condition is parsed as '"1||" != "" || 0'.
+.if 1|| || 0
+.else
+.  error
+.endif

Reply via email to