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 extreme edge ...
details: https://anonhg.NetBSD.org/src/rev/c53679e33d92
branches: trunk
changeset: 958301:c53679e33d92
user: rillig <rillig%NetBSD.org@localhost>
date: Thu Dec 31 13:23:43 2020 +0000
description:
make(1): add tests for extreme edge cases of .for loop expansion
diffstat:
usr.bin/make/unit-tests/directive-for-escape.exp | 8 ++++++++
usr.bin/make/unit-tests/directive-for-escape.mk | 20 +++++++++++++++++++-
2 files changed, 27 insertions(+), 1 deletions(-)
diffs (49 lines):
diff -r ecd25c0a5c1e -r c53679e33d92 usr.bin/make/unit-tests/directive-for-escape.exp
--- a/usr.bin/make/unit-tests/directive-for-escape.exp Thu Dec 31 12:34:33 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-for-escape.exp Thu Dec 31 13:23:43 2020 +0000
@@ -38,6 +38,14 @@
For: loop body:
. info ${:U\$}
make: "directive-for-escape.mk" line 60: $
+For: end for 1
+For: loop body:
+. info ${NUMBERS} ${:Ureplaced}
+make: "directive-for-escape.mk" line 68: one two three replaced
+For: end for 1
+For: loop body:
+. info ${:Ureplaced}
+make: "directive-for-escape.mk" line 78: replaced
make: no target to make.
make: stopped in unit-tests
diff -r ecd25c0a5c1e -r c53679e33d92 usr.bin/make/unit-tests/directive-for-escape.mk
--- a/usr.bin/make/unit-tests/directive-for-escape.mk Thu Dec 31 12:34:33 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-for-escape.mk Thu Dec 31 13:23:43 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: directive-for-escape.mk,v 1.1 2020/12/31 03:05:12 rillig Exp $
+# $NetBSD: directive-for-escape.mk,v 1.2 2020/12/31 13:23:43 rillig Exp $
#
# Test escaping of special characters in the iteration values of a .for loop.
# These values get expanded later using the :U variable modifier, and this
@@ -59,3 +59,21 @@
.for i in ${:U\$}
. info ${i}
.endfor
+
+# As of 2020-12-31, the name of the iteration variable can even contain
+# colons, which then affects variable expressions having this exact modifier.
+# This is clearly an unintended side effect of the implementation.
+NUMBERS= one two three
+.for NUMBERS:M*e in replaced
+. info ${NUMBERS} ${NUMBERS:M*e}
+.endfor
+
+# As of 2020-12-31, the name of the iteration variable can contain braces,
+# which gets even more surprising than colons, since it allows to replace
+# sequences of variable expressions. There is no practical use case for
+# this, though.
+BASENAME= one
+EXT= .c
+.for BASENAME}${EXT in replaced
+. info ${BASENAME}${EXT}
+.endfor
Home |
Main Index |
Thread Index |
Old Index