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(1): add test for escaping paren...



details:   https://anonhg.NetBSD.org/src/rev/0342cb2adf0e
branches:  trunk
changeset: 977499:0342cb2adf0e
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Oct 25 14:55:23 2020 +0000

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

diffstat:

 usr.bin/make/unit-tests/directive-for.exp |  12 ++++++++++++
 usr.bin/make/unit-tests/directive-for.mk  |   9 ++++++++-
 2 files changed, 20 insertions(+), 1 deletions(-)

diffs (42 lines):

diff -r 49947f072578 -r 0342cb2adf0e usr.bin/make/unit-tests/directive-for.exp
--- a/usr.bin/make/unit-tests/directive-for.exp Sun Oct 25 14:29:13 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-for.exp Sun Oct 25 14:55:23 2020 +0000
@@ -2,4 +2,16 @@
 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
diff -r 49947f072578 -r 0342cb2adf0e usr.bin/make/unit-tests/directive-for.mk
--- a/usr.bin/make/unit-tests/directive-for.mk  Sun Oct 25 14:29:13 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-for.mk  Sun Oct 25 14:55:23 2020 +0000
@@ -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 @@
 .  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:
        @:;



Home | Main Index | Thread Index | Old Index