Module Name: src Committed By: rillig Date: Sun Dec 20 23:29:50 UTC 2020
Modified Files: src/usr.bin/make/unit-tests: varmod-to-many-words.mk varmod-to-one-word.mk Log Message: make(1): add tests for :tW and :tw modifiers To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-to-many-words.mk \ src/usr.bin/make/unit-tests/varmod-to-one-word.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/make/unit-tests/varmod-to-many-words.mk diff -u src/usr.bin/make/unit-tests/varmod-to-many-words.mk:1.2 src/usr.bin/make/unit-tests/varmod-to-many-words.mk:1.3 --- src/usr.bin/make/unit-tests/varmod-to-many-words.mk:1.2 Sun Aug 16 14:25:16 2020 +++ src/usr.bin/make/unit-tests/varmod-to-many-words.mk Sun Dec 20 23:29:50 2020 @@ -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: @:; Index: src/usr.bin/make/unit-tests/varmod-to-one-word.mk diff -u src/usr.bin/make/unit-tests/varmod-to-one-word.mk:1.2 src/usr.bin/make/unit-tests/varmod-to-one-word.mk:1.3 --- src/usr.bin/make/unit-tests/varmod-to-one-word.mk:1.2 Sun Aug 16 14:25:16 2020 +++ src/usr.bin/make/unit-tests/varmod-to-one-word.mk Sun Dec 20 23:29:50 2020 @@ -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: @:;