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 :S,,sep



details:   https://anonhg.NetBSD.org/src/rev/58f6c3cec600
branches:  trunk
changeset: 974061:58f6c3cec600
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Jul 21 23:19:46 2020 +0000

description:
make(1): add test for :S,,sep

The empty string does not match anywhere.  In other implementations of
string replacement, an empty string matches at every position of the
source string.

This only works for the :S modifier.  The :C modifier does not allow an
empty search pattern.

diffstat:

 usr.bin/make/unit-tests/modmisc.exp |  3 +++
 usr.bin/make/unit-tests/modmisc.mk  |  5 ++++-
 2 files changed, 7 insertions(+), 1 deletions(-)

diffs (44 lines):

diff -r 45e2d3cf415d -r 58f6c3cec600 usr.bin/make/unit-tests/modmisc.exp
--- a/usr.bin/make/unit-tests/modmisc.exp       Tue Jul 21 21:34:41 2020 +0000
+++ b/usr.bin/make/unit-tests/modmisc.exp       Tue Jul 21 23:19:46 2020 +0000
@@ -17,11 +17,14 @@
 S:empty
 C:empty
 @:
+mod-S:
 :a b b c:
 :a b b c:
 : b c:
 :a c:
 :x__ 3 x__ 3:
+12345
+mod-C:
 :a b b c:
 :a b b c:
 : b c:
diff -r 45e2d3cf415d -r 58f6c3cec600 usr.bin/make/unit-tests/modmisc.mk
--- a/usr.bin/make/unit-tests/modmisc.mk        Tue Jul 21 21:34:41 2020 +0000
+++ b/usr.bin/make/unit-tests/modmisc.mk        Tue Jul 21 23:19:46 2020 +0000
@@ -1,4 +1,4 @@
-# $Id: modmisc.mk,v 1.19 2020/07/21 21:34:41 rillig Exp $
+# $Id: modmisc.mk,v 1.20 2020/07/21 23:19:46 rillig Exp $
 #
 # miscellaneous modifier tests
 
@@ -67,13 +67,16 @@
        @echo @:${:U:@var@empty@}
 
 mod-S:
+       @echo $@:
        @echo :${:Ua b b c:S,a b,,:Q}:
        @echo :${:Ua b b c:S,a b,,1:Q}:
        @echo :${:Ua b b c:S,a b,,W:Q}:
        @echo :${:Ua b b c:S,b,,g:Q}:
        @echo :${:U1 2 3 1 2 3:S,1 2,___,Wg:S,_,x,:Q}:
+       @echo ${:U12345:S,,sep,g:Q}
 
 mod-C:
+       @echo $@:
        @echo :${:Ua b b c:C,a b,,:Q}:
        @echo :${:Ua b b c:C,a b,,1:Q}:
        @echo :${:Ua b b c:C,a b,,W:Q}:



Home | Main Index | Thread Index | Old Index