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 tests/make: add more edge cases for ...



details:   https://anonhg.NetBSD.org/src/rev/3c012127eba6
branches:  trunk
changeset: 359856:3c012127eba6
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Jan 27 20:15:14 2022 +0000

description:
tests/make: add more edge cases for expansion of .for loop body

diffstat:

 usr.bin/make/unit-tests/directive-for-escape.exp |   9 +++++++++
 usr.bin/make/unit-tests/directive-for-escape.mk  |  18 ++++++++++++++++--
 2 files changed, 25 insertions(+), 2 deletions(-)

diffs (58 lines):

diff -r 189ffa494e94 -r 3c012127eba6 usr.bin/make/unit-tests/directive-for-escape.exp
--- a/usr.bin/make/unit-tests/directive-for-escape.exp  Thu Jan 27 18:44:49 2022 +0000
+++ b/usr.bin/make/unit-tests/directive-for-escape.exp  Thu Jan 27 20:15:14 2022 +0000
@@ -125,6 +125,15 @@
 # ${:U${:U\$\$}}
 For: end for 1
 For: loop body:
+# ${:U${.TARGET}}
+For: loop body:
+# ${:U${.TARGET}}
+For: loop body:
+# ${:U$${.TARGET\}}
+For: loop body:
+# ${:U$${.TARGET\}}
+For: end for 1
+For: loop body:
 # ${:U(((}
 For: loop body:
 # ${:U{{{}
diff -r 189ffa494e94 -r 3c012127eba6 usr.bin/make/unit-tests/directive-for-escape.mk
--- a/usr.bin/make/unit-tests/directive-for-escape.mk   Thu Jan 27 18:44:49 2022 +0000
+++ b/usr.bin/make/unit-tests/directive-for-escape.mk   Thu Jan 27 20:15:14 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: directive-for-escape.mk,v 1.14 2022/01/27 11:26:44 rillig Exp $
+# $NetBSD: directive-for-escape.mk,v 1.15 2022/01/27 20:15:14 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
@@ -65,7 +65,7 @@
 # FIXME: There was no expression '$\' in the original text of the previous
 # line, that's a surprise in the parser.
 # The modifier ':U' unescapes the '\$' to a simple '$'.
-# expect+4: ${UNDEF:U\$
+# expect+4: ${UNDEF:U\backslash$
 VALUES=                $${UNDEF:U\$$\$$ {{}} end}
 # XXX: Where in the code does the '\$\$' get converted into a single '\$'?
 .for i in ${VALUES}
@@ -178,6 +178,20 @@
 # $i
 .endfor
 
+# The expression '${.TARGET}' must be preserved as it is one of the 7 built-in
+# target-local variables.  See for.c 1.45 from 2009-01-14.
+.for i in ${.TARGET} $${.TARGET} $$${.TARGET} $$$${.TARGET}
+# $i
+.endfor
+# expect: # ${:U${.TARGET}}
+# XXX: Why does '$' result in the same text as '$$'?
+# expect: # ${:U${.TARGET}}
+# XXX: Why does the '$$' before the '${.TARGET}' lead to an escaped '}'?
+# expect: # ${:U$${.TARGET\}}
+# XXX: Why does '$' result in the same text as '$$'?
+# XXX: Why does the '$$' before the '${.TARGET}' lead to an escaped '}'?
+# expect: # ${:U$${.TARGET\}}
+
 .for i in ((( {{{ ))) }}}
 # $i
 .endfor



Home | Main Index | Thread Index | Old Index