make(1): move tests for :hash :range :localtime into separate files

This commit is contained in:
rillig 2020-08-23 15:13:21 +00:00
parent 81e2228996
commit 2070e56d26
8 changed files with 34 additions and 58 deletions

View File

@ -21,25 +21,4 @@ line
mod-break-many-words: 500
mod-remember: 1 2 3 1 2 3 1 2 3
mod-remember: 1 2 3, SAVED=3
mod-localtime:
%Y
2020
%Y
mod-hash:
make: Unknown modifier 'h'
26bb0f5f
12345
make: Unknown modifier 'h'
make: Unknown modifier 'h'
mod-range:
make: Unknown modifier 'r'
1 2 3
make: Unknown modifier 'r'
make: Unknown modifier 'r'
exit status 0

View File

@ -1,4 +1,4 @@
# $Id: modmisc.mk,v 1.44 2020/08/23 15:09:15 rillig Exp $
# $Id: modmisc.mk,v 1.45 2020/08/23 15:13:21 rillig Exp $
#
# miscellaneous modifier tests
@ -20,9 +20,6 @@ all: mod-tu-space
all: mod-quote
all: mod-break-many-words
all: mod-remember
all: mod-localtime
all: mod-hash
all: mod-range
# See also sysv.mk.
modsysv:
@ -82,27 +79,6 @@ mod-remember:
@echo $@: ${1 2 3:L:_:@var@${_}@}
@echo $@: ${1 2 3:L:@var@${var:_=SAVED:}@}, SAVED=${SAVED}
mod-localtime:
@echo $@:
@echo ${%Y:L:localtim=1593536400} # modifier name too short
@echo ${%Y:L:localtime=1593536400} # 2020-07-01T00:00:00Z
@echo ${%Y:L:localtimer=1593536400} # modifier name too long
mod-hash:
@echo $@:
@echo ${12345:L:has} # modifier name too short
@echo ${12345:L:hash} # ok
@echo ${12345:L:hash=SHA-256} # :hash does not accept '='
@echo ${12345:L:hasX} # misspelled
@echo ${12345:L:hashed} # modifier name too long
mod-range:
@echo $@:
@echo ${a b c:L:rang} # modifier name too short
@echo ${a b c:L:range} # ok
@echo ${a b c:L:rango} # misspelled
@echo ${a b c:L:ranger} # modifier name too long
# To apply a modifier indirectly via another variable, the whole
# modifier must be put into a single variable.
.if ${value:L:${:US}${:U,value,replacement,}} != "S,value,replacement,}"

View File

@ -1 +1,9 @@
make: Unknown modifier 'h'
26bb0f5f
12345
make: Unknown modifier 'h'
make: Unknown modifier 'h'
exit status 0

View File

@ -1,8 +1,10 @@
# $NetBSD: varmod-hash.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
# $NetBSD: varmod-hash.mk,v 1.3 2020/08/23 15:13:21 rillig Exp $
#
# Tests for the :hash variable modifier.
# TODO: Implementation
all:
@:;
@echo ${12345:L:has} # modifier name too short
@echo ${12345:L:hash} # ok
@echo ${12345:L:hash=SHA-256} # :hash does not accept '='
@echo ${12345:L:hasX} # misspelled
@echo ${12345:L:hashed} # modifier name too long

View File

@ -1 +1,4 @@
%Y
2020
%Y
exit status 0

View File

@ -1,9 +1,9 @@
# $NetBSD: varmod-localtime.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
# $NetBSD: varmod-localtime.mk,v 1.3 2020/08/23 15:13:21 rillig Exp $
#
# Tests for the :localtime variable modifier, which returns the given time,
# formatted as a local timestamp.
# TODO: Implementation
all:
@:;
@echo ${%Y:L:localtim=1593536400} # modifier name too short
@echo ${%Y:L:localtime=1593536400} # 2020-07-01T00:00:00Z
@echo ${%Y:L:localtimer=1593536400} # modifier name too long

View File

@ -1 +1,8 @@
make: Unknown modifier 'r'
1 2 3
make: Unknown modifier 'r'
make: Unknown modifier 'r'
exit status 0

View File

@ -1,9 +1,10 @@
# $NetBSD: varmod-range.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
# $NetBSD: varmod-range.mk,v 1.3 2020/08/23 15:13:21 rillig Exp $
#
# Tests for the :range variable modifier, which generates sequences
# of integers from the given range.
# TODO: Implementation
all:
@:;
@echo ${a b c:L:rang} # modifier name too short
@echo ${a b c:L:range} # ok
@echo ${a b c:L:rango} # misspelled
@echo ${a b c:L:ranger} # modifier name too long