make(1): demonstrate off-by-one bug in :C modifier

This commit is contained in:
rillig 2020-07-19 17:24:22 +00:00
parent 822e1c79f4
commit 4f983c4e37
2 changed files with 20 additions and 1 deletions

View File

@ -51,4 +51,14 @@ mod-loop-dollar:$3$:
mod-loop-dollar:$${word}$:
mod-loop-dollar:$$5$$:
mod-loop-dollar:$$${word}$$:
mod-C-limits:00-ok:1 2323 45456
mod-C-limits:11-missing:1 6
mod-C-limits:11-ok:1 22 446
make: No subexpression \2
make: No subexpression \2
make: No subexpression \2
make: No subexpression \2
mod-C-limits:22-missing:1 6
mod-C-limits:22-missing:1 6
mod-C-limits:22-ok:1 33 556
exit status 0

View File

@ -1,4 +1,4 @@
# $Id: modmisc.mk,v 1.13 2020/07/19 15:16:22 rillig Exp $
# $Id: modmisc.mk,v 1.14 2020/07/19 17:24:22 rillig Exp $
#
# miscellaneous modifier tests
@ -18,6 +18,7 @@ MOD_SEP=S,:, ,g
all: modvar modvarloop modsysv mod-HTE emptyvar undefvar
all: mod-S mod-C mod-at-varname mod-at-resolve mod-at-dollar
all: mod-subst-dollar mod-loop-dollar
all: mod-C-limits
modsysv:
@echo "The answer is ${libfoo.a:L:libfoo.a=42}"
@ -133,3 +134,11 @@ mod-loop-dollar:
@echo $@:${:U4:@word@$$$${word}$$$$@:Q}:
@echo $@:${:U5:@word@$$$$${word}$$$$$@:Q}:
@echo $@:${:U6:@word@$$$$$${word}$$$$$$@:Q}:
mod-C-limits:
@echo $@:00-ok:${:U1 23 456:C,..,\0\0,:Q}
@echo $@:11-missing:${:U1 23 456:C,..,\1\1,:Q}
@echo $@:11-ok:${:U1 23 456:C,(.).,\1\1,:Q}
@echo $@:22-missing:${:U1 23 456:C,..,\2\2,:Q}
@echo $@:22-missing:${:U1 23 456:C,(.).,\2\2,:Q}
@echo $@:22-ok:${:U1 23 456:C,(.)(.),\2\2,:Q}