Module Name:    src
Committed By:   rillig
Date:           Sun Jul 26 13:09:53 UTC 2020

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

Log Message:
make(1): add basic tests for the :S modifier


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 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.mk
diff -u src/usr.bin/make/unit-tests/modmisc.mk:1.25 src/usr.bin/make/unit-tests/modmisc.mk:1.26
--- src/usr.bin/make/unit-tests/modmisc.mk:1.25	Sun Jul 26 12:19:37 2020
+++ src/usr.bin/make/unit-tests/modmisc.mk	Sun Jul 26 13:09:53 2020
@@ -1,4 +1,4 @@
-# $Id: modmisc.mk,v 1.25 2020/07/26 12:19:37 rillig Exp $
+# $Id: modmisc.mk,v 1.26 2020/07/26 13:09:53 rillig Exp $
 #
 # miscellaneous modifier tests
 
@@ -73,23 +73,53 @@ undefvar:
 	@echo @:${:U:@var@empty@}
 
 WORDS=		sequences of letters
+.if ${WORDS:S,,,} != ${WORDS}
+.warning The empty pattern matches something.
+.endif
 .if ${WORDS:S,e,*,1} != "s*quences of letters"
-.warning ${WORDS:S,e,*,1}
+.warning The :S modifier flag '1' is not applied exactly once.
 .endif
 .if ${WORDS:S,e,*,} != "s*quences of l*tters"
-.error oops
+.warning The :S modifier does not replace every first match per word.
 .endif
 .if ${WORDS:S,e,*,g} != "s*qu*nc*s of l*tt*rs"
-.error oops
+.warning The :S modifier flag 'g' does not replace every occurrence.
 .endif
 .if ${WORDS:S,^sequ,occurr,} != "occurrences of letters"
-.error oops
+.warning The :S modifier fails for a short match anchored at the start.
 .endif
 .if ${WORDS:S,^of,with,} != "sequences with letters"
-.error oops
+.warning The :S modifier fails for an exact match anchored at the start.
 .endif
 .if ${WORDS:S,^office,does not match,} != ${WORDS}
-.error oops
+.warning The :S modifier matches a too long pattern anchored at the start.
+.endif
+.if ${WORDS:S,f$,r,} != "sequences or letters"
+.warning The :S modifier fails for a short match anchored at the end.
+.endif
+.if ${WORDS:S,s$,,} != "sequence of letter"
+.warning The :S modifier fails to replace one occurrence per word.
+.endif
+.if ${WORDS:S,of$,,} != "sequences letters"
+.warning The :S modifier fails for an exact match anchored at the end.
+.endif
+.if ${WORDS:S,eof$,,} != ${WORDS}
+.warning The :S modifier matches a too long pattern anchored at the end.
+.endif
+.if ${WORDS:S,^of$,,} != "sequences letters"
+.warning The :S modifier does not match a word anchored at both ends.
+.endif
+.if ${WORDS:S,^o$,,} != ${WORDS}
+.warning The :S modifier matches a prefix anchored at both ends.
+.endif
+.if ${WORDS:S,^f$,,} != ${WORDS}
+.warning The :S modifier matches a suffix anchored at both ends.
+.endif
+.if ${WORDS:S,^eof$,,} != ${WORDS}
+.warning The :S modifier matches a too long prefix anchored at both ends.
+.endif
+.if ${WORDS:S,^office$,,} != ${WORDS}
+.warning The :S modifier matches a too long suffix anchored at both ends.
 .endif
 
 mod-subst:

Reply via email to