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: improve comments in test for e...



details:   https://anonhg.NetBSD.org/src/rev/72ace7198e61
branches:  trunk
changeset: 959470:72ace7198e61
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Feb 15 07:58:19 2021 +0000

description:
make: improve comments in test for expansions in .for loops

diffstat:

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

diffs (112 lines):

diff -r 9f3be601f0dd -r 72ace7198e61 usr.bin/make/unit-tests/directive-for-escape.exp
--- a/usr.bin/make/unit-tests/directive-for-escape.exp  Mon Feb 15 07:42:35 2021 +0000
+++ b/usr.bin/make/unit-tests/directive-for-escape.exp  Mon Feb 15 07:58:19 2021 +0000
@@ -37,19 +37,19 @@
 For: end for 1
 For: loop body:
 .  info ${:Ubegin<${UNDEF:Ufallback:N{{{}}}}>end}
-make: "directive-for-escape.mk" line 66: begin<fallback>end
+make: "directive-for-escape.mk" line 67: begin<fallback>end
 For: end for 1
 For: loop body:
 .  info ${:U\$}
-make: "directive-for-escape.mk" line 74: $
+make: "directive-for-escape.mk" line 75: $
 For: end for 1
 For: loop body:
 .  info ${NUMBERS} ${:Ureplaced}
-make: "directive-for-escape.mk" line 82: one two three replaced
+make: "directive-for-escape.mk" line 83: one two three replaced
 For: end for 1
 For: loop body:
 .  info ${:Ureplaced}
-make: "directive-for-escape.mk" line 92: replaced
+make: "directive-for-escape.mk" line 93: replaced
 For: end for 1
 For: loop body:
 .  info .        $$i: ${:Uinner}
@@ -62,14 +62,14 @@
 .  info .     $${i2}: ${i2}
 .  info .     $${i,}: ${i,}
 .  info .  adjacent: ${:Uinner}${:Uinner}${:Uinner:M*}${:Uinner}
-make: "directive-for-escape.mk" line 100: .        $i: inner
-make: "directive-for-escape.mk" line 101: .      ${i}: inner
-make: "directive-for-escape.mk" line 102: .   ${i:M*}: inner
-make: "directive-for-escape.mk" line 103: .      $(i): inner
-make: "directive-for-escape.mk" line 104: .   $(i:M*): inner
-make: "directive-for-escape.mk" line 105: . ${i${:U}}: outer
-make: "directive-for-escape.mk" line 106: .    ${i\}}: inner}
-make: "directive-for-escape.mk" line 107: .     ${i2}: two
-make: "directive-for-escape.mk" line 108: .     ${i,}: comma
-make: "directive-for-escape.mk" line 109: .  adjacent: innerinnerinnerinner
+make: "directive-for-escape.mk" line 101: .        $i: inner
+make: "directive-for-escape.mk" line 102: .      ${i}: inner
+make: "directive-for-escape.mk" line 103: .   ${i:M*}: inner
+make: "directive-for-escape.mk" line 104: .      $(i): inner
+make: "directive-for-escape.mk" line 105: .   $(i:M*): inner
+make: "directive-for-escape.mk" line 106: . ${i${:U}}: outer
+make: "directive-for-escape.mk" line 107: .    ${i\}}: inner}
+make: "directive-for-escape.mk" line 108: .     ${i2}: two
+make: "directive-for-escape.mk" line 109: .     ${i,}: comma
+make: "directive-for-escape.mk" line 110: .  adjacent: innerinnerinnerinner
 exit status 0
diff -r 9f3be601f0dd -r 72ace7198e61 usr.bin/make/unit-tests/directive-for-escape.mk
--- a/usr.bin/make/unit-tests/directive-for-escape.mk   Mon Feb 15 07:42:35 2021 +0000
+++ b/usr.bin/make/unit-tests/directive-for-escape.mk   Mon Feb 15 07:58:19 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: directive-for-escape.mk,v 1.6 2021/01/25 19:05:39 rillig Exp $
+# $NetBSD: directive-for-escape.mk,v 1.7 2021/02/15 07:58:19 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
@@ -7,8 +7,8 @@
 
 .MAKEFLAGS: -df
 
-# Even though the .for loops takes quotes into account when splitting the
-# string into words, the quotes don't need to be balances, as of 2020-12-31.
+# Even though the .for loops take quotes into account when splitting the
+# string into words, the quotes don't need to be balanced, as of 2020-12-31.
 # This could be considered a bug.
 ASCII= !"\#$$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~
 
@@ -33,7 +33,7 @@
 #
 # XXX: It is unexpected that the variable V gets expanded in the loop body.
 # The double '$$' should prevent exactly this.  Probably nobody was
-# adventurous enough to use literal dollar signs in the values for a .for
+# adventurous enough to use literal dollar signs in the values of a .for
 # loop.
 V=             value
 VALUES=                $$ $${V} $${V:=-with-modifier} $$(V) $$(V:=-with-modifier)
@@ -43,14 +43,14 @@
 
 # Try to cover the code for nested '{}' in for_var_len, without success.
 #
-# The value of VALUES is not meant to be a variable expression.  Instead, it
-# is meant to represent dollar, lbrace, "UNDEF:U", backslash, dollar,
-# backslash, dollar, space, nested braces, space, "end}".
+# The value of the variable VALUES is not meant to be a variable expression.
+# Instead, it is meant to represent literal text, the only escaping mechanism
+# being that each '$' is written as '$$'.
 #
 # The .for loop splits ${VALUES} into 3 words, at the space characters, since
 # these are not escaped.
 VALUES=                $${UNDEF:U\$$\$$ {{}} end}
-# XXX: Where does the '\$$\$$' get converted into a single '\$'?
+# XXX: Where in the code does the '\$\$' get converted into a single '\$'?
 .for i in ${VALUES}
 .  info $i
 .endfor
@@ -59,8 +59,9 @@
 #
 # XXX: It is wrong that for_var_len requires the braces to be balanced.
 # Each variable modifier has its own inconsistent way of parsing nested
-# variable expressions, braces and parentheses.  The only sensible thing
-# to do is therefore to let Var_Parse do all the parsing work.
+# variable expressions, braces and parentheses.  (Compare ':M', ':S', and
+# ':D' for details.)  The only sensible thing to do is therefore to let
+# Var_Parse do all the parsing work.
 VALUES=                begin<$${UNDEF:Ufallback:N{{{}}}}>end
 .for i in ${VALUES}
 .  info $i



Home | Main Index | Thread Index | Old Index