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 spaces in con...
details: https://anonhg.NetBSD.org/src/rev/28f0d5104726
branches: trunk
changeset: 955196:28f0d5104726
user: rillig <rillig%NetBSD.org@localhost>
date: Wed Sep 23 08:11:28 2020 +0000
description:
make(1): add tests for spaces in condition functions
diffstat:
usr.bin/make/unit-tests/cond-func-empty.mk | 15 ++++++++++++++-
usr.bin/make/unit-tests/cond-func.mk | 10 +++++++++-
2 files changed, 23 insertions(+), 2 deletions(-)
diffs (51 lines):
diff -r 1b62cbf75b46 -r 28f0d5104726 usr.bin/make/unit-tests/cond-func-empty.mk
--- a/usr.bin/make/unit-tests/cond-func-empty.mk Wed Sep 23 07:54:08 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-func-empty.mk Wed Sep 23 08:11:28 2020 +0000
@@ -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 @@
. 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:
@:;
diff -r 1b62cbf75b46 -r 28f0d5104726 usr.bin/make/unit-tests/cond-func.mk
--- a/usr.bin/make/unit-tests/cond-func.mk Wed Sep 23 07:54:08 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-func.mk Wed Sep 23 08:11:28 2020 +0000
@@ -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 @@
.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:
@:;
Home |
Main Index |
Thread Index |
Old Index