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 test for function argum...
details: https://anonhg.NetBSD.org/src/rev/eac06c7416b2
branches: trunk
changeset: 956870:eac06c7416b2
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Nov 08 21:40:13 2020 +0000
description:
make(1): add test for function argument with unbalanced braces
diffstat:
usr.bin/make/unit-tests/cond-func.exp | 12 ++++++------
usr.bin/make/unit-tests/cond-func.mk | 15 +++++++++++++--
2 files changed, 19 insertions(+), 8 deletions(-)
diffs (55 lines):
diff -r 76c10f67a5a3 -r eac06c7416b2 usr.bin/make/unit-tests/cond-func.exp
--- a/usr.bin/make/unit-tests/cond-func.exp Sun Nov 08 21:33:05 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-func.exp Sun Nov 08 21:40:13 2020 +0000
@@ -1,9 +1,9 @@
-make: "cond-func.mk" line 29: warning: Missing closing parenthesis for defined()
-make: "cond-func.mk" line 29: Malformed conditional (!defined(A B))
-make: "cond-func.mk" line 44: warning: Missing closing parenthesis for defined()
-make: "cond-func.mk" line 44: Malformed conditional (!defined(A&B))
-make: "cond-func.mk" line 47: warning: Missing closing parenthesis for defined()
-make: "cond-func.mk" line 47: Malformed conditional (!defined(A|B))
+make: "cond-func.mk" line 34: warning: Missing closing parenthesis for defined()
+make: "cond-func.mk" line 34: Malformed conditional (!defined(A B))
+make: "cond-func.mk" line 49: warning: Missing closing parenthesis for defined()
+make: "cond-func.mk" line 49: Malformed conditional (!defined(A&B))
+make: "cond-func.mk" line 52: warning: Missing closing parenthesis for defined()
+make: "cond-func.mk" line 52: Malformed conditional (!defined(A|B))
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff -r 76c10f67a5a3 -r eac06c7416b2 usr.bin/make/unit-tests/cond-func.mk
--- a/usr.bin/make/unit-tests/cond-func.mk Sun Nov 08 21:33:05 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-func.mk Sun Nov 08 21:40:13 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: cond-func.mk,v 1.5 2020/11/08 21:33:05 rillig Exp $
+# $NetBSD: cond-func.mk,v 1.6 2020/11/08 21:40:13 rillig Exp $
#
# Tests for those parts of the functions in .if conditions that are common
# among several functions.
@@ -9,7 +9,12 @@
DEF= defined
${:UA B}= variable name with spaces
${:UVAR(value)}= variable name with parentheses
-${:UVAR{value}}= variable name with braces
+${:UVAR{value}}= variable name with balanced braces
+
+# Really strange variable names must be given indirectly via another variable,
+# so that no unbalanced braces appear in the top-level expression.
+VARNAME_UNBALANCED_BRACES= VAR{{{value
+${VARNAME_UNBALANCED_BRACES}= variable name with unbalanced braces
.if !defined(DEF)
. error
@@ -59,6 +64,12 @@
. error
.endif
+# Braces do not have any special meaning when parsing arguments.
+# They don't need to be balanced.
+.if !defined(VAR{{{value)
+. 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
Home |
Main Index |
Thread Index |
Old Index