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 tests/make: test modifier ':S' with ...



details:   https://anonhg.NetBSD.org/src/rev/3c25e8b89af7
branches:  trunk
changeset: 985762:3c25e8b89af7
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Sep 06 21:18:55 2021 +0000

description:
tests/make: test modifier ':S' with replacement '&'

Before 2020-08-30, OpenBSD make incorrectly copied the anchors '^' and
'$' to the replacement string.  Just guard against this possible bug.

diffstat:

 usr.bin/make/unit-tests/varmod-subst.mk |  15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diffs (29 lines):

diff -r 1e16fa76d756 -r 3c25e8b89af7 usr.bin/make/unit-tests/varmod-subst.mk
--- a/usr.bin/make/unit-tests/varmod-subst.mk   Mon Sep 06 20:55:08 2021 +0000
+++ b/usr.bin/make/unit-tests/varmod-subst.mk   Mon Sep 06 21:18:55 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-subst.mk,v 1.8 2021/05/14 19:37:16 rillig Exp $
+# $NetBSD: varmod-subst.mk,v 1.9 2021/09/06 21:18:55 rillig Exp $
 #
 # Tests for the :S,from,to, variable modifier.
 
@@ -86,6 +86,19 @@
 .  error The '.' seems to be interpreted as a wildcard of some kind.
 .endif
 
+.if ${:Uvalue:S,^val,&,} != "value"
+.  error
+.endif
+.if ${:Uvalue:S,ue$,&,} != "value"
+.  error
+.endif
+.if ${:Uvalue:S,^val,&-&-&,} != "val-val-value"
+.  error
+.endif
+.if ${:Uvalue:S,ue$,&-&-&,} != "value-ue-ue"
+.  error
+.endif
+
 mod-subst:
        @echo $@:
        @echo :${:Ua b b c:S,a b,,:Q}:



Home | Main Index | Thread Index | Old Index