Module Name:    src
Committed By:   rillig
Date:           Sun Oct 25 14:55:23 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: directive-for.exp directive-for.mk

Log Message:
make(1): add test for escaping parentheses and braces in .for loops


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/directive-for.exp
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/directive-for.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.exp
diff -u src/usr.bin/make/unit-tests/directive-for.exp:1.4 src/usr.bin/make/unit-tests/directive-for.exp:1.5
--- src/usr.bin/make/unit-tests/directive-for.exp:1.4	Tue Sep 22 19:08:48 2020
+++ src/usr.bin/make/unit-tests/directive-for.exp	Sun Oct 25 14:55:23 2020
@@ -2,4 +2,16 @@ make: "directive-for.mk" line 100: outer
 make: "directive-for.mk" line 125: a:\ a:\file.txt
 make: "directive-for.mk" line 125: d:\\
 make: "directive-for.mk" line 125: d:\\file.txt
+make: "directive-for.mk" line 132: ( ( (
+make: "directive-for.mk" line 132: [ [ [
+make: "directive-for.mk" line 132: { { {
+make: "directive-for.mk" line 132: ) ) )
+make: "directive-for.mk" line 132: ] ] ]
+make: "directive-for.mk" line 132: } } }
+make: "directive-for.mk" line 132: (()) (()) (())
+make: "directive-for.mk" line 132: [[]] [[]] [[]]
+make: "directive-for.mk" line 132: {{}} {{}} {{}}
+make: "directive-for.mk" line 132: )( )( )(
+make: "directive-for.mk" line 132: ][ ][ ][
+make: "directive-for.mk" line 132: }{ }{ }{
 exit status 0

Index: src/usr.bin/make/unit-tests/directive-for.mk
diff -u src/usr.bin/make/unit-tests/directive-for.mk:1.6 src/usr.bin/make/unit-tests/directive-for.mk:1.7
--- src/usr.bin/make/unit-tests/directive-for.mk:1.6	Sat Oct 24 08:50:17 2020
+++ src/usr.bin/make/unit-tests/directive-for.mk	Sun Oct 25 14:55:23 2020
@@ -1,4 +1,4 @@
-# $NetBSD: directive-for.mk,v 1.6 2020/10/24 08:50:17 rillig Exp $
+# $NetBSD: directive-for.mk,v 1.7 2020/10/25 14:55:23 rillig Exp $
 #
 # Tests for the .for directive.
 
@@ -125,5 +125,12 @@ EXPANSION${plus}=	value
 .  info ${path}
 .endfor
 
+# Ensure that braces and parentheses are properly escaped by the .for loop.
+# Each line must print the same word 3 times.
+# See GetEscapes.
+.for v in ( [ { ) ] } (()) [[]] {{}} )( ][ }{
+.  info $v ${v} $(v)
+.endfor
+
 all:
 	@:;

Reply via email to