Home | History | Annotate | Line # | Download | only in unit-tests
varmod-subst-regex.mk revision 1.2
      1 # $NetBSD: varmod-subst-regex.mk,v 1.2 2020/08/16 12:30:45 rillig Exp $
      2 #
      3 # Tests for the :C,from,to, variable modifier.
      4 
      5 all: mod-regex
      6 all: mod-regex-limits
      7 all: mod-regex-errors
      8 
      9 mod-regex:
     10 	@echo $@:
     11 	@echo :${:Ua b b c:C,a b,,:Q}:
     12 	@echo :${:Ua b b c:C,a b,,1:Q}:
     13 	@echo :${:Ua b b c:C,a b,,W:Q}:
     14 	@echo :${:Uword1 word2:C,****,____,g:C,word,____,:Q}:
     15 	@echo :${:Ua b b c:C,b,,g:Q}:
     16 	@echo :${:U1 2 3 1 2 3:C,1 2,___,Wg:C,_,x,:Q}:
     17 
     18 mod-regex-limits:
     19 	@echo $@:00-ok:${:U1 23 456:C,..,\0\0,:Q}
     20 	@echo $@:11-missing:${:U1 23 456:C,..,\1\1,:Q}
     21 	@echo $@:11-ok:${:U1 23 456:C,(.).,\1\1,:Q}
     22 	@echo $@:22-missing:${:U1 23 456:C,..,\2\2,:Q}
     23 	@echo $@:22-missing:${:U1 23 456:C,(.).,\2\2,:Q}
     24 	@echo $@:22-ok:${:U1 23 456:C,(.)(.),\2\2,:Q}
     25 	# The :C modifier only handles single-digit capturing groups,
     26 	# which is more than enough for daily use.
     27 	@echo $@:capture:${:UabcdefghijABCDEFGHIJrest:C,(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.),\9\8\7\6\5\4\3\2\1\0\10\11\12,}
     28 
     29 mod-regex-errors:
     30 	@echo $@: ${UNDEF:Uvalue:C,[,,}
     31