Module Name: src
Committed By: rillig
Date: Sun Jul 7 11:20:10 UTC 2024
Modified Files:
src/usr.bin/make/unit-tests: directive-for-escape.exp
directive-for-escape.mk
Log Message:
tests/make: remove '# expect' lines from .exp file
These lines are only supposed to occur in .mk files.
To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 \
src/usr.bin/make/unit-tests/directive-for-escape.exp
cvs rdiff -u -r1.27 -r1.28 \
src/usr.bin/make/unit-tests/directive-for-escape.mk
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/unit-tests/directive-for-escape.exp
diff -u src/usr.bin/make/unit-tests/directive-for-escape.exp:1.29 src/usr.bin/make/unit-tests/directive-for-escape.exp:1.30
--- src/usr.bin/make/unit-tests/directive-for-escape.exp:1.29 Sat Jul 6 10:14:35 2024
+++ src/usr.bin/make/unit-tests/directive-for-escape.exp Sun Jul 7 11:20:10 2024
@@ -1,134 +1,45 @@
For: end for 1
For: loop body with chars = !"#$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~:
-# expect+2: while evaluating "${:U!"" with value "!"": Unclosed expression, expecting '}' for modifier "U!""
-# expect+1: !"
. info ${:U!"#$%&'()*+,-./0-9\:;<=>?@A-Z[\\]_^a-z{|\}~}
make: "directive-for-escape.mk" line 21: while evaluating "${:U!"" with value "!"": Unclosed expression, expecting '}' for modifier "U!""
- in .for loop from directive-for-escape.mk:18 with chars = !"#$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~
+ in .for loop from directive-for-escape.mk:20 with chars = !"#$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~
make: "directive-for-escape.mk" line 21: !"
For: end for 1
For: loop body with chars = !"\\#$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~:
-# expect+2: while evaluating "${:U!"\\\\" with value "!"\\": Unclosed expression, expecting '}' for modifier "U!"\\\\"
-# expect+1: !"\\
. info ${:U!"\\\\#$%&'()*+,-./0-9\:;<=>?@A-Z[\\]_^a-z{|\}~}
make: "directive-for-escape.mk" line 33: while evaluating "${:U!"\\\\" with value "!"\\": Unclosed expression, expecting '}' for modifier "U!"\\\\"
- in .for loop from directive-for-escape.mk:30 with chars = !"\\#$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~
+ in .for loop from directive-for-escape.mk:32 with chars = !"\\#$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~
make: "directive-for-escape.mk" line 33: !"\\
For: end for 1
For: loop body with i = $:
-# expect: . info ${:U\$}
-# expect+9: $
-# expect: . info ${:U${V}}
-# expect+7: value
-# expect: . info ${:U${V:=-with-modifier}}
-# expect+5: value-with-modifier
-# expect: . info ${:U$(V)}
-# expect+3: value
-# expect: . info ${:U$(V:=-with-modifier)}
-# expect+1: value-with-modifier
. info ${:U\$}
make: "directive-for-escape.mk" line 57: $
For: loop body with i = ${V}:
-# expect: . info ${:U\$}
-# expect+9: $
-# expect: . info ${:U${V}}
-# expect+7: value
-# expect: . info ${:U${V:=-with-modifier}}
-# expect+5: value-with-modifier
-# expect: . info ${:U$(V)}
-# expect+3: value
-# expect: . info ${:U$(V:=-with-modifier)}
-# expect+1: value-with-modifier
. info ${:U${V}}
make: "directive-for-escape.mk" line 57: value
For: loop body with i = ${V:=-with-modifier}:
-# expect: . info ${:U\$}
-# expect+9: $
-# expect: . info ${:U${V}}
-# expect+7: value
-# expect: . info ${:U${V:=-with-modifier}}
-# expect+5: value-with-modifier
-# expect: . info ${:U$(V)}
-# expect+3: value
-# expect: . info ${:U$(V:=-with-modifier)}
-# expect+1: value-with-modifier
. info ${:U${V:=-with-modifier}}
make: "directive-for-escape.mk" line 57: value-with-modifier
For: loop body with i = $(V):
-# expect: . info ${:U\$}
-# expect+9: $
-# expect: . info ${:U${V}}
-# expect+7: value
-# expect: . info ${:U${V:=-with-modifier}}
-# expect+5: value-with-modifier
-# expect: . info ${:U$(V)}
-# expect+3: value
-# expect: . info ${:U$(V:=-with-modifier)}
-# expect+1: value-with-modifier
. info ${:U$(V)}
make: "directive-for-escape.mk" line 57: value
For: loop body with i = $(V:=-with-modifier):
-# expect: . info ${:U\$}
-# expect+9: $
-# expect: . info ${:U${V}}
-# expect+7: value
-# expect: . info ${:U${V:=-with-modifier}}
-# expect+5: value-with-modifier
-# expect: . info ${:U$(V)}
-# expect+3: value
-# expect: . info ${:U$(V:=-with-modifier)}
-# expect+1: value-with-modifier
. info ${:U$(V:=-with-modifier)}
make: "directive-for-escape.mk" line 57: value-with-modifier
For: end for 1
For: loop body with i = $:
-# expect: . info ${:U\$}
-# expect+6: $
-# expect: . info ${:U${V}}
-# expect+4: value
-# expect+3: value-with-modifier
-# expect+2: value
-# expect+1: value-with-modifier
. info ${:U\$}
make: "directive-for-escape.mk" line 69: $
For: loop body with i = ${V}:
-# expect: . info ${:U\$}
-# expect+6: $
-# expect: . info ${:U${V}}
-# expect+4: value
-# expect+3: value-with-modifier
-# expect+2: value
-# expect+1: value-with-modifier
. info ${:U${V}}
make: "directive-for-escape.mk" line 69: value
For: loop body with i = ${V:=-with-modifier}:
-# expect: . info ${:U\$}
-# expect+6: $
-# expect: . info ${:U${V}}
-# expect+4: value
-# expect+3: value-with-modifier
-# expect+2: value
-# expect+1: value-with-modifier
. info ${:U${V:=-with-modifier}}
make: "directive-for-escape.mk" line 69: value-with-modifier
For: loop body with i = $(V):
-# expect: . info ${:U\$}
-# expect+6: $
-# expect: . info ${:U${V}}
-# expect+4: value
-# expect+3: value-with-modifier
-# expect+2: value
-# expect+1: value-with-modifier
. info ${:U$(V)}
make: "directive-for-escape.mk" line 69: value
For: loop body with i = $(V:=-with-modifier):
-# expect: . info ${:U\$}
-# expect+6: $
-# expect: . info ${:U${V}}
-# expect+4: value
-# expect+3: value-with-modifier
-# expect+2: value
-# expect+1: value-with-modifier
. info ${:U$(V:=-with-modifier)}
make: "directive-for-escape.mk" line 69: value-with-modifier
For: end for 1
@@ -140,31 +51,20 @@ For: loop body with i = end}:
# ${:Uend\}}
For: end for 1
For: loop body with i = ${UNDEF:U\$\$:
-# expect+3: ${UNDEF:U\backslash$
-# expect+2: {{}}
-# expect+1: end}
. info ${:U\${UNDEF\:U\\$\\$}
make: "directive-for-escape.mk" line 120: ${UNDEF:U\backslash$
For: loop body with i = {{}}:
-# expect+3: ${UNDEF:U\backslash$
-# expect+2: {{}}
-# expect+1: end}
. info ${:U{{\}\}}
make: "directive-for-escape.mk" line 120: {{}}
For: loop body with i = end}:
-# expect+3: ${UNDEF:U\backslash$
-# expect+2: {{}}
-# expect+1: end}
. info ${:Uend\}}
make: "directive-for-escape.mk" line 120: end}
For: end for 1
For: loop body with i = begin<${UNDEF:Ufallback:N{{{}}}}>end:
-# expect+1: begin<fallback>end
. info ${:Ubegin<${UNDEF:Ufallback:N{{{}}}}>end}
make: "directive-for-escape.mk" line 138: begin<fallback>end
For: end for 1
For: loop body with i = $:
-# expect+1: $
. info ${:U\$}
make: "directive-for-escape.mk" line 147: $
make: "directive-for-escape.mk" line 155: invalid character ':' in .for loop variable name
@@ -173,72 +73,52 @@ make: "directive-for-escape.mk" line 165
For: end for 1
For: end for 1
For: loop body with i = inner:
-# expect+1: . ${:Uinner}: inner
-. info . $$i: ${:Uinner}
-# expect+1: . ${:Uinner}: inner
-. info . $${i}: ${:Uinner}
-# expect+1: . ${:Uinner:M*}: inner
-. info . $${i:M*}: ${:Uinner:M*}
-# expect+1: . $(:Uinner): inner
-. info . $$(i): $(:Uinner)
-# expect+1: . $(:Uinner:M*): inner
-. info . $$(i:M*): $(:Uinner:M*)
-# expect+1: . ${i${:U}}: outer
-. info . $${i$${:U}}: ${i${:U}}
-# expect+1: . ${:Uinner\}}: inner}
-. info . $${i\}}: ${:Uinner\}} # XXX: unclear why ForLoop_SubstVarLong needs this
-# expect+1: . ${i2}: two
-. info . $${i2}: ${i2}
-# expect+1: . ${i,}: comma
-. info . $${i,}: ${i,}
-# expect+1: . adjacent: innerinnerinnerinner
-. info . adjacent: ${:Uinner}${:Uinner}${:Uinner:M*}${:Uinner}
-make: "directive-for-escape.mk" line 175: . $i: inner
-make: "directive-for-escape.mk" line 177: . ${i}: inner
-make: "directive-for-escape.mk" line 179: . ${i:M*}: inner
-make: "directive-for-escape.mk" line 181: . $(i): inner
-make: "directive-for-escape.mk" line 183: . $(i:M*): inner
-make: "directive-for-escape.mk" line 185: . ${i${:U}}: outer
-make: "directive-for-escape.mk" line 187: . ${i\}}: inner}
-make: "directive-for-escape.mk" line 189: . ${i2}: two
-make: "directive-for-escape.mk" line 191: . ${i,}: comma
-make: "directive-for-escape.mk" line 193: . adjacent: innerinnerinnerinner
-make: "directive-for-escape.mk" line 202: invalid character '$' in .for loop variable name
+. info ${:Uinner} ${:Uinner} ${:Uinner:M*} $(:Uinner) $(:Uinner:M*)
+make: "directive-for-escape.mk" line 175: inner inner inner inner inner
For: end for 1
-make: "directive-for-escape.mk" line 214: eight and no cents.
+For: loop body with i = inner:
+. info ${i${:U}}
+make: "directive-for-escape.mk" line 179: outer
+For: end for 1
+For: loop body with i = inner:
+. info ${:Uinner\}} # XXX: unclear why ForLoop_SubstVarLong needs this
+make: "directive-for-escape.mk" line 183: inner}
+For: end for 1
+For: loop body with i = inner:
+. info ${i2} ${i,} ${:Uinner}${:Uinner}${:Uinner:M*}${:Uinner}
+make: "directive-for-escape.mk" line 187: two comma innerinnerinnerinner
+make: "directive-for-escape.mk" line 196: invalid character '$' in .for loop variable name
+For: end for 1
+make: "directive-for-escape.mk" line 208: eight and no cents.
For: end for 1
-make: "directive-for-escape.mk" line 227: newline in .for value
- in .for loop from directive-for-escape.mk:227 with i = "
+make: "directive-for-escape.mk" line 222: newline in .for value
+ in .for loop from directive-for-escape.mk:222 with i = "
"
-make: "directive-for-escape.mk" line 227: newline in .for value
- in .for loop from directive-for-escape.mk:227 with i = "
+make: "directive-for-escape.mk" line 222: newline in .for value
+ in .for loop from directive-for-escape.mk:222 with i = "
"
For: loop body with i = "
":
-# expect+1: short: " "
-. info short: ${:U" "}
-# expect+1: long: " "
-. info long: ${:U" "}
-make: "directive-for-escape.mk" line 229: short: " "
-make: "directive-for-escape.mk" line 231: long: " "
+. info short: ${:U" "}, long: ${:U" "}
+make: "directive-for-escape.mk" line 223: short: " ", long: " "
For: end for 1
For: loop body with i = "
":
-Parsing line 244: .for i in "${.newline}"
+Parsing line 236: .for i in "${.newline}"
For: end for 1
-Parse_PushInput: .for loop in directive-for-escape.mk, line 244
-make: "directive-for-escape.mk" line 244: newline in .for value
- in .for loop from directive-for-escape.mk:244 with i = "
+Parse_PushInput: .for loop in directive-for-escape.mk, line 236
+make: "directive-for-escape.mk" line 236: newline in .for value
+ in .for loop from directive-for-escape.mk:236 with i = "
"
For: loop body with i = "
":
: ${:U" "}
SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `directive-for-escape.mk'
-Parsing line 245: : ${:U" "}
+Parsing line 237: : ${:U" "}
ParseDependency(: " ")
-ParseEOF: returning to file directive-for-escape.mk, line 247
+ParseEOF: returning to file directive-for-escape.mk, line 239
SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `directive-for-escape.mk'
-Parsing line 247: .MAKEFLAGS: -d0
+Parsing line 239: .MAKEFLAGS: -d0
ParseDependency(.MAKEFLAGS: -d0)
For: end for 1
For: loop body with i = #:
Index: src/usr.bin/make/unit-tests/directive-for-escape.mk
diff -u src/usr.bin/make/unit-tests/directive-for-escape.mk:1.27 src/usr.bin/make/unit-tests/directive-for-escape.mk:1.28
--- src/usr.bin/make/unit-tests/directive-for-escape.mk:1.27 Sat Jul 6 10:14:35 2024
+++ src/usr.bin/make/unit-tests/directive-for-escape.mk Sun Jul 7 11:20:10 2024
@@ -1,4 +1,4 @@
-# $NetBSD: directive-for-escape.mk,v 1.27 2024/07/06 10:14:35 rillig Exp $
+# $NetBSD: directive-for-escape.mk,v 1.28 2024/07/07 11:20:10 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
@@ -15,9 +15,9 @@ ASCII= !"\#$$%&'()*+,-./0-9:;<=>?@A-Z[\]
# XXX: As of 2020-12-31, the '#' is not preserved in the expanded body of
# the loop. Not only would it need the escaping for the variable modifier
# ':U' but also the escaping for the line-end comment.
+# expect+3: while evaluating "${:U!"" with value "!"": Unclosed expression, expecting '}' for modifier "U!""
+# expect+2: !"
.for chars in ${ASCII}
-# expect+2: while evaluating "${:U!"" with value "!"": Unclosed expression, expecting '}' for modifier "U!""
-# expect+1: !"
. info ${chars}
.endfor
@@ -27,9 +27,9 @@ ASCII= !"\#$$%&'()*+,-./0-9:;<=>?@A-Z[\]
# This means that a '#' sign cannot be passed in the value of a .for loop
# at all.
ASCII.2020-12-31= !"\\\#$$%&'()*+,-./0-9:;<=>?@A-Z[\]_^a-z{|}~
+# expect+3: while evaluating "${:U!"\\\\" with value "!"\\": Unclosed expression, expecting '}' for modifier "U!"\\\\"
+# expect+2: !"\\
.for chars in ${ASCII.2020-12-31}
-# expect+2: while evaluating "${:U!"\\\\" with value "!"\\": Unclosed expression, expecting '}' for modifier "U!"\\\\"
-# expect+1: !"\\
. info ${chars}
.endfor
@@ -43,29 +43,29 @@ ASCII.2020-12-31= !"\\\#$$%&'()*+,-./0-9
# See for.c, function ExprLen.
V= value
VALUES= $$ $${V} $${V:=-with-modifier} $$(V) $$(V:=-with-modifier)
-.for i in ${VALUES}
# expect: . info ${:U\$}
-# expect+9: $
+# expect+10: $
# expect: . info ${:U${V}}
-# expect+7: value
+# expect+8: value
# expect: . info ${:U${V:=-with-modifier}}
-# expect+5: value-with-modifier
+# expect+6: value-with-modifier
# expect: . info ${:U$(V)}
-# expect+3: value
+# expect+4: value
# expect: . info ${:U$(V:=-with-modifier)}
-# expect+1: value-with-modifier
+# expect+2: value-with-modifier
+.for i in ${VALUES}
. info $i
.endfor
#
# Providing the loop items directly has the same effect.
-.for i in $$ $${V} $${V:=-with-modifier} $$(V) $$(V:=-with-modifier)
# expect: . info ${:U\$}
-# expect+6: $
+# expect+7: $
# expect: . info ${:U${V}}
-# expect+4: value
-# expect+3: value-with-modifier
-# expect+2: value
-# expect+1: value-with-modifier
+# expect+5: value
+# expect+4: value-with-modifier
+# expect+3: value
+# expect+2: value-with-modifier
+.for i in $$ $${V} $${V:=-with-modifier} $$(V) $$(V:=-with-modifier)
. info $i
.endfor
@@ -113,10 +113,10 @@ VALUES= $${UNDEF:U\$$\$$ {{}} end}
#
# To make the expression '$\' visible, define it to an actual word:
${:U\\}= backslash
+# expect+4: ${UNDEF:U\backslash$
+# expect+3: {{}}
+# expect+2: end}
.for i in ${VALUES}
-# expect+3: ${UNDEF:U\backslash$
-# expect+2: {{}}
-# expect+1: end}
. info $i
.endfor
#
@@ -124,7 +124,7 @@ ${:U\\}= backslash
# 'VALUES', that's a surprise in the parser.
-# Second try to cover the code for nested '{}' in ExprLen.
+# The second attempt to cover the code for nested '{}' in ExprLen.
#
# XXX: It is not the job of ExprLen to parse an expression, it is naive to
# expect ExprLen to get all the details right in just a few lines of code.
@@ -133,8 +133,8 @@ ${:U\\}= backslash
# ':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
+# expect+2: begin<fallback>end
.for i in ${VALUES}
-# expect+1: begin<fallback>end
. info $i
.endfor
@@ -142,8 +142,8 @@ VALUES= begin<$${UNDEF:Ufallback:N{{{}}
# The dollar sign is correctly passed through to the body of the .for loop.
# There, it is expanded by the .info directive, but even there a trailing
# dollar sign is kept as-is.
+# expect+2: $
.for i in ${:U\$}
-# expect+1: $
. info ${i}
.endfor
@@ -170,27 +170,21 @@ EXT= .c
i= outer
i2= two
i,= comma
+# expect+2: inner inner inner inner inner
.for i in inner
-# expect+1: . $i: inner
-. info . $$i: $i
-# expect+1: . ${i}: inner
-. info . $${i}: ${i}
-# expect+1: . ${i:M*}: inner
-. info . $${i:M*}: ${i:M*}
-# expect+1: . $(i): inner
-. info . $$(i): $(i)
-# expect+1: . $(i:M*): inner
-. info . $$(i:M*): $(i:M*)
-# expect+1: . ${i${:U}}: outer
-. info . $${i$${:U}}: ${i${:U}}
-# expect+1: . ${i\}}: inner}
-. info . $${i\}}: ${i\}} # XXX: unclear why ForLoop_SubstVarLong needs this
-# expect+1: . ${i2}: two
-. info . $${i2}: ${i2}
-# expect+1: . ${i,}: comma
-. info . $${i,}: ${i,}
-# expect+1: . adjacent: innerinnerinnerinner
-. info . adjacent: $i${i}${i:M*}$i
+. info $i ${i} ${i:M*} $(i) $(i:M*)
+.endfor
+# expect+2: outer
+.for i in inner
+. info ${i${:U}}
+.endfor
+# expect+2: inner}
+.for i in inner
+. info ${i\}} # XXX: unclear why ForLoop_SubstVarLong needs this
+.endfor
+# expect+2: two comma innerinnerinnerinner
+.for i in inner
+. info ${i2} ${i,} $i${i}${i:M*}$i
.endfor
# Before for.c 1.173 from 2023-05-08, the variable name could be a single '$'
@@ -222,13 +216,11 @@ ${closing-brace}= <closing-brace> # alte
# The error message occurs in the line of the .for loop since that's the place
# where the body of the .for loop is constructed, and at this point the
# newline character gets replaced with a plain space.
+# expect+3: newline in .for value
# expect+2: newline in .for value
-# expect+1: newline in .for value
+# expect+2: short: " ", long: " "
.for i in "${.newline}"
-# expect+1: short: " "
-. info short: $i
-# expect+1: long: " "
-. info long: ${i}
+. info short: $i, long: ${i}
.endfor
# No error since the newline character is not actually used in the body.
.for i in "${.newline}"