Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make/unit-tests make(1): add tests for :tW and :tw m...



details:   https://anonhg.NetBSD.org/src/rev/27f7f4975e17
branches:  trunk
changeset: 958045:27f7f4975e17
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Dec 20 23:29:50 2020 +0000

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

diffstat:

 usr.bin/make/unit-tests/varmod-to-many-words.mk |  16 ++++++++++++++--
 usr.bin/make/unit-tests/varmod-to-one-word.mk   |  16 ++++++++++++++--
 2 files changed, 28 insertions(+), 4 deletions(-)

diffs (54 lines):

diff -r 7159a0549d5c -r 27f7f4975e17 usr.bin/make/unit-tests/varmod-to-many-words.mk
--- a/usr.bin/make/unit-tests/varmod-to-many-words.mk   Sun Dec 20 23:27:37 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-to-many-words.mk   Sun Dec 20 23:29:50 2020 +0000
@@ -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:
        @:;
diff -r 7159a0549d5c -r 27f7f4975e17 usr.bin/make/unit-tests/varmod-to-one-word.mk
--- a/usr.bin/make/unit-tests/varmod-to-one-word.mk     Sun Dec 20 23:27:37 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-to-one-word.mk     Sun Dec 20 23:29:50 2020 +0000
@@ -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:
        @:;



Home | Main Index | Thread Index | Old Index