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 basic tests for the :S ...



details:   https://anonhg.NetBSD.org/src/rev/5d2832993c1c
branches:  trunk
changeset: 936390:5d2832993c1c
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jul 26 13:09:53 2020 +0000

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

diffstat:

 usr.bin/make/unit-tests/modmisc.mk |  44 +++++++++++++++++++++++++++++++------
 1 files changed, 37 insertions(+), 7 deletions(-)

diffs (69 lines):

diff -r a64efd2dffc0 -r 5d2832993c1c usr.bin/make/unit-tests/modmisc.mk
--- a/usr.bin/make/unit-tests/modmisc.mk        Sun Jul 26 12:43:27 2020 +0000
+++ b/usr.bin/make/unit-tests/modmisc.mk        Sun Jul 26 13:09:53 2020 +0000
@@ -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 @@
        @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:



Home | Main Index | Thread Index | Old Index