summaryrefslogtreecommitdiff
path: root/usr.bin/make/unit-tests
diff options
context:
space:
mode:
authorrillig <rillig@NetBSD.org>2023-05-08 09:24:42 +0000
committerrillig <rillig@NetBSD.org>2023-05-08 09:24:42 +0000
commitdac53ce792c2bcf2b4cafcc3e2596d3f2b8226b3 (patch)
tree413c222f8bb9cf70c410f5c9dbd21a5c7d32858f /usr.bin/make/unit-tests
parent9efaea6000b02478f1989849fc7a60593d655ae9 (diff)
tests/make: add more tests for unusual variable names in .for loops
Diffstat (limited to 'usr.bin/make/unit-tests')
-rw-r--r--usr.bin/make/unit-tests/directive-for.exp23
-rw-r--r--usr.bin/make/unit-tests/directive-for.mk14
2 files changed, 26 insertions, 11 deletions
diff --git a/usr.bin/make/unit-tests/directive-for.exp b/usr.bin/make/unit-tests/directive-for.exp
index af99d5f41cf..b18b76a6351 100644
--- a/usr.bin/make/unit-tests/directive-for.exp
+++ b/usr.bin/make/unit-tests/directive-for.exp
@@ -16,16 +16,19 @@ make: "directive-for.mk" line 140: ][ ][ ][
make: "directive-for.mk" line 140: }{ }{ }{
make: "directive-for.mk" line 148: outer value value
make: "directive-for.mk" line 148: outer "quoted" \"quoted\"
-make: "directive-for.mk" line 154: Unknown modifier "Z"
-make: "directive-for.mk" line 155: XXX: Not reached word1
-make: "directive-for.mk" line 155: XXX: Not reached word3
-make: "directive-for.mk" line 160: no iteration variables in for
-make: "directive-for.mk" line 162: Missing argument for ".error"
-make: "directive-for.mk" line 163: for-less endfor
-make: "directive-for.mk" line 187: 1 open conditional
-make: "directive-for.mk" line 203: for-less endfor
-make: "directive-for.mk" line 204: if-less endif
-make: "directive-for.mk" line 212: if-less endif
+make: "directive-for.mk" line 154: $ value value
+make: "directive-for.mk" line 160: <> <> <a>
+make: "directive-for.mk" line 160: <> <> <b>
+make: "directive-for.mk" line 166: Unknown modifier "Z"
+make: "directive-for.mk" line 167: XXX: Not reached word1
+make: "directive-for.mk" line 167: XXX: Not reached word3
+make: "directive-for.mk" line 172: no iteration variables in for
+make: "directive-for.mk" line 174: Missing argument for ".error"
+make: "directive-for.mk" line 175: for-less endfor
+make: "directive-for.mk" line 199: 1 open conditional
+make: "directive-for.mk" line 215: for-less endfor
+make: "directive-for.mk" line 216: if-less endif
+make: "directive-for.mk" line 224: if-less endif
For: new loop 2
For: end for 2
For: end for 1
diff --git a/usr.bin/make/unit-tests/directive-for.mk b/usr.bin/make/unit-tests/directive-for.mk
index 9b05ad90d9c..367fa1becaa 100644
--- a/usr.bin/make/unit-tests/directive-for.mk
+++ b/usr.bin/make/unit-tests/directive-for.mk
@@ -1,4 +1,4 @@
-# $NetBSD: directive-for.mk,v 1.16 2023/05/08 09:01:20 rillig Exp $
+# $NetBSD: directive-for.mk,v 1.17 2023/05/08 09:24:42 rillig Exp $
#
# Tests for the .for directive.
#
@@ -147,6 +147,18 @@ var= outer
.for var:Q in value "quoted"
. info ${var} ${var:Q} ${var:Q:Q}
.endfor
+# The short expression '$$' is preserved, the long expressions are
+# substituted.
+# expect+2: $ value value
+.for $ in value
+. info $$ ${$} $($)
+.endfor
+# From https://gnats.netbsd.org/53146.
+# expect+3: <> <> <a>
+# expect+2: <> <> <b>
+.for $(FOO) in a b
+. info <$(FOO)> <$(foo)> <$($(FOO))>
+.endfor
# XXX: A parse error or evaluation error in the items of the .for loop