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 combining :sh ...
details: https://anonhg.NetBSD.org/src/rev/988a6a56a7f2
branches: trunk
changeset: 976797:988a6a56a7f2
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Oct 04 08:32:52 2020 +0000
description:
make(1): add test for combining :sh with +=
diffstat:
usr.bin/make/unit-tests/var-op-sunsh.mk | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diffs (37 lines):
diff -r ff0daf4d9dfb -r 988a6a56a7f2 usr.bin/make/unit-tests/var-op-sunsh.mk
--- a/usr.bin/make/unit-tests/var-op-sunsh.mk Sun Oct 04 08:22:59 2020 +0000
+++ b/usr.bin/make/unit-tests/var-op-sunsh.mk Sun Oct 04 08:32:52 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: var-op-sunsh.mk,v 1.4 2020/10/04 08:14:35 rillig Exp $
+# $NetBSD: var-op-sunsh.mk,v 1.5 2020/10/04 08:32:52 rillig Exp $
#
# Tests for the :sh= variable assignment operator, which runs its right-hand
# side through the shell. It is a seldom-used alternative to the !=
@@ -82,8 +82,9 @@
# Parse_DoVar completely trusts Parse_IsVar to properly verify the syntax.
#
# The ':sh' is the only word that may occur between the variable name and
-# the assignment operator. All other words would lead to a parse error
-# since the left-hand side of an assignment must be exactly one word.
+# the assignment operator at nesting level 0. All other words would lead
+# to a parse error since the left-hand side of an assignment must be
+# exactly one word.
VAR :sh :sh :sh :sh= echo multiple
.if ${VAR} != "multiple"
. error
@@ -107,5 +108,15 @@
. error
.endif
+# Syntactically, the ':sh' modifier can be combined with the '+=' assignment
+# operator. In such a case the ':sh' modifier is silently ignored.
+#
+# XXX: This combination should not be allowed at all.
+VAR= one
+VAR :sh += echo two
+.if ${VAR} != "one echo two"
+. error ${VAR}
+.endif
+
all:
@:;
Home |
Main Index |
Thread Index |
Old Index