make(1): add tests for :tW and :tw modifiers

This commit is contained in:
rillig 2020-12-20 23:29:50 +00:00
parent b8f5741af7
commit 23688beebb
2 changed files with 28 additions and 4 deletions

View File

@ -1,9 +1,21 @@
# $NetBSD: varmod-to-many-words.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
# $NetBSD: varmod-to-many-words.mk,v 1.3 2020/12/20 23:29:50 rillig Exp $
#
# Tests for the :tw modifier, which treats the variable as many words,
# to undo a previous :tW modifier.
# TODO: Implementation
SENTENCE= The quick brown fox jumps over the lazy brown dog.
.if ${SENTENCE:tw:[#]} != 10
. error
.endif
.if ${SENTENCE:tW:[#]} != 1
. error
.endif
# Protect against accidental freeing of the variable value.
.if ${SENTENCE} != "The quick brown fox jumps over the lazy brown dog."
. error
.endif
all:
@:;

View File

@ -1,9 +1,21 @@
# $NetBSD: varmod-to-one-word.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
# $NetBSD: varmod-to-one-word.mk,v 1.3 2020/12/20 23:29:50 rillig Exp $
#
# Tests for the :tW variable modifier, which treats the variable value
# as a single word, for all following modifiers.
# TODO: Implementation
SENTENCE= The quick brown fox jumps over the lazy brown dog.
.if ${SENTENCE:tW:[#]} != 1
. error
.endif
.if ${SENTENCE:tw:[#]} != 10
. error
.endif
# Protect against accidental freeing of the variable value.
.if ${SENTENCE} != "The quick brown fox jumps over the lazy brown dog."
. error
.endif
all:
@:;