Module Name: src
Committed By: rillig
Date: Sat Nov 30 02:31:19 UTC 2019
Modified Files:
src/usr.bin/make/unit-tests: varmod-edge.exp varmod-edge.mk
Log Message:
Add another unit test for the :M modifier
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/varmod-edge.exp \
src/usr.bin/make/unit-tests/varmod-edge.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/varmod-edge.exp
diff -u src/usr.bin/make/unit-tests/varmod-edge.exp:1.1 src/usr.bin/make/unit-tests/varmod-edge.exp:1.2
--- src/usr.bin/make/unit-tests/varmod-edge.exp:1.1 Sat Nov 30 00:38:51 2019
+++ src/usr.bin/make/unit-tests/varmod-edge.exp Sat Nov 30 02:31:19 2019
@@ -4,4 +4,5 @@ ok M-mixed
ok M-nest-mix
ok M-nest-brk
ok M-pat-err
+ok M-bsbs
exit status 0
Index: src/usr.bin/make/unit-tests/varmod-edge.mk
diff -u src/usr.bin/make/unit-tests/varmod-edge.mk:1.1 src/usr.bin/make/unit-tests/varmod-edge.mk:1.2
--- src/usr.bin/make/unit-tests/varmod-edge.mk:1.1 Sat Nov 30 00:38:51 2019
+++ src/usr.bin/make/unit-tests/varmod-edge.mk Sat Nov 30 02:31:19 2019
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-edge.mk,v 1.1 2019/11/30 00:38:51 rillig Exp $
+# $NetBSD: varmod-edge.mk,v 1.2 2019/11/30 02:31:19 rillig Exp $
#
# Tests for edge cases in variable modifiers.
#
@@ -54,11 +54,26 @@ EXP.M-nest-brk= [
# No error is reported though, and the pattern is closed implicitly.
#
# XXX: It is unexpected that no error is reported.
+# See str.c, function Str_Match.
TESTS+= M-pat-err
INP.M-pat-err= [ [[ [[[
MOD.M-pat-err= ${INP.M-pat-err:M${:U[[}}
EXP.M-pat-err= [
+# The first backslash does not escape the second backslash.
+# Therefore, the second backslash escapes the parenthesis.
+# This means that the pattern ends there.
+# The final } in the output comes from the end of MOD.M-bsbs.
+#
+# If the first backslash were to escape the second backslash, the first
+# closing brace would match the opening parenthesis (see M-mixed), and
+# the second closing brace would be needed to close the variable.
+TESTS+= M-bsbs
+INP.M-bsbs= \( \(}
+MOD.M-bsbs= ${INP.M-bsbs:M\\(}}
+EXP.M-bsbs= \(}
+#EXP.M-bsbs= \( # If the first backslash were to escape ...
+
all:
.for test in ${TESTS}
. if ${MOD.${test}} == ${EXP.${test}}