Module Name:    src
Committed By:   rillig
Date:           Wed Sep 23 08:11:28 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: cond-func-empty.mk cond-func.mk

Log Message:
make(1): add tests for spaces in condition functions


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/cond-func-empty.mk
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/cond-func.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-func-empty.mk
diff -u src/usr.bin/make/unit-tests/cond-func-empty.mk:1.7 src/usr.bin/make/unit-tests/cond-func-empty.mk:1.8
--- src/usr.bin/make/unit-tests/cond-func-empty.mk:1.7	Wed Sep 23 07:50:58 2020
+++ src/usr.bin/make/unit-tests/cond-func-empty.mk	Wed Sep 23 08:11:28 2020
@@ -1,4 +1,4 @@
-# $NetBSD: cond-func-empty.mk,v 1.7 2020/09/23 07:50:58 rillig Exp $
+# $NetBSD: cond-func-empty.mk,v 1.8 2020/09/23 08:11:28 rillig Exp $
 #
 # Tests for the empty() function in .if conditions, which tests a variable
 # expression for emptiness.
@@ -133,5 +133,18 @@ ${:U }=	space
 .  error
 .endif
 
+# There may be spaces at the outside of the parentheses.
+# Spaces inside the parentheses are interpreted as part of the variable name.
+.if ! empty ( WORD )
+.  error
+.endif
+
+${:U WORD }=	variable name with spaces
+
+# Now there is a variable named " WORD ", and it is not empty.
+.if empty ( WORD )
+.  error
+.endif
+
 all:
 	@:;

Index: src/usr.bin/make/unit-tests/cond-func.mk
diff -u src/usr.bin/make/unit-tests/cond-func.mk:1.1 src/usr.bin/make/unit-tests/cond-func.mk:1.2
--- src/usr.bin/make/unit-tests/cond-func.mk:1.1	Thu Aug 20 17:45:47 2020
+++ src/usr.bin/make/unit-tests/cond-func.mk	Wed Sep 23 08:11:28 2020
@@ -1,4 +1,4 @@
-# $NetBSD: cond-func.mk,v 1.1 2020/08/20 17:45:47 rillig Exp $
+# $NetBSD: cond-func.mk,v 1.2 2020/09/23 08:11:28 rillig Exp $
 #
 # Tests for those parts of the functions in .if conditions that are common
 # among several functions.
@@ -59,5 +59,13 @@ ${:UVAR{value}}=	variable name with brac
 .error
 .endif
 
+# There may be spaces around the operators and parentheses, and even
+# inside the parentheses.  The spaces inside the parentheses are not
+# allowed for the empty() function (see cond-func-empty.mk), therefore
+# they are typically omitted for the other functions as well.
+.if ! defined ( DEF )
+.  error
+.endif
+
 all:
 	@:;

Reply via email to