Module Name:    src
Committed By:   rillig
Date:           Tue Jul 21 23:19:46 UTC 2020

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

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/make/unit-tests/modmisc.exp
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/modmisc.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/modmisc.exp
diff -u src/usr.bin/make/unit-tests/modmisc.exp:1.24 src/usr.bin/make/unit-tests/modmisc.exp:1.25
--- src/usr.bin/make/unit-tests/modmisc.exp:1.24	Tue Jul 21 21:34:41 2020
+++ src/usr.bin/make/unit-tests/modmisc.exp	Tue Jul 21 23:19:46 2020
@@ -17,11 +17,14 @@ C:
 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:

Index: src/usr.bin/make/unit-tests/modmisc.mk
diff -u src/usr.bin/make/unit-tests/modmisc.mk:1.19 src/usr.bin/make/unit-tests/modmisc.mk:1.20
--- src/usr.bin/make/unit-tests/modmisc.mk:1.19	Tue Jul 21 21:34:41 2020
+++ src/usr.bin/make/unit-tests/modmisc.mk	Tue Jul 21 23:19:46 2020
@@ -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 @@ undefvar:
 	@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}:

Reply via email to