Module Name: src
Committed By: rillig
Date: Sun Aug 23 15:18:43 UTC 2020
Modified Files:
src/usr.bin/make/unit-tests: modmisc.exp modmisc.mk varmod-remember.exp
varmod-remember.mk varmod-to-upper.exp varmod-to-upper.mk
Log Message:
make(1): move tests for the :tu and :_ modifiers into separate files
To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/usr.bin/make/unit-tests/modmisc.exp \
src/usr.bin/make/unit-tests/modmisc.mk
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/varmod-remember.exp \
src/usr.bin/make/unit-tests/varmod-to-upper.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-remember.mk \
src/usr.bin/make/unit-tests/varmod-to-upper.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/modmisc.exp
diff -u src/usr.bin/make/unit-tests/modmisc.exp:1.45 src/usr.bin/make/unit-tests/modmisc.exp:1.46
--- src/usr.bin/make/unit-tests/modmisc.exp:1.45 Sun Aug 23 15:13:21 2020
+++ src/usr.bin/make/unit-tests/modmisc.exp Sun Aug 23 15:18:43 2020
@@ -14,11 +14,8 @@ C:
S:empty
C:empty
@:
-mod-tu-space: A B
mod-quote: new
line
mod-break-many-words: 500
-mod-remember: 1 2 3 1 2 3 1 2 3
-mod-remember: 1 2 3, SAVED=3
exit status 0
Index: src/usr.bin/make/unit-tests/modmisc.mk
diff -u src/usr.bin/make/unit-tests/modmisc.mk:1.45 src/usr.bin/make/unit-tests/modmisc.mk:1.46
--- src/usr.bin/make/unit-tests/modmisc.mk:1.45 Sun Aug 23 15:13:21 2020
+++ src/usr.bin/make/unit-tests/modmisc.mk Sun Aug 23 15:18:43 2020
@@ -1,4 +1,4 @@
-# $Id: modmisc.mk,v 1.45 2020/08/23 15:13:21 rillig Exp $
+# $Id: modmisc.mk,v 1.46 2020/08/23 15:18:43 rillig Exp $
#
# miscellaneous modifier tests
@@ -16,10 +16,8 @@ MOD_OPT=@d@$${exists($$d):?$$d:$${d:S,/u
MOD_SEP=S,:, ,g
all: modvar modvarloop modsysv emptyvar undefvar
-all: mod-tu-space
all: mod-quote
all: mod-break-many-words
-all: mod-remember
# See also sysv.mk.
modsysv:
@@ -58,11 +56,6 @@ undefvar:
@echo C:${:U:C,^$,empty,}
@echo @:${:U:@var@empty@}
-mod-tu-space:
- # The :tu and :tl modifiers operate on the variable value
- # as a single string, not as a list of words. Therefore,
- # the adjacent spaces are preserved.
- @echo $@: ${a b:L:tu:Q}
mod-quote:
@echo $@: new${.newline:Q}${.newline:Q}line
@@ -71,14 +64,6 @@ mod-quote:
mod-break-many-words:
@echo $@: ${UNDEF:U:range=500:[#]}
-# Demonstrate the :_ modifier.
-# In the parameterized form, having the variable name on the right side
-# of the = assignment operator is confusing. Luckily this modifier is
-# only rarely needed.
-mod-remember:
- @echo $@: ${1 2 3:L:_:@var@${_}@}
- @echo $@: ${1 2 3:L:@var@${var:_=SAVED:}@}, SAVED=${SAVED}
-
# 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,}"
Index: src/usr.bin/make/unit-tests/varmod-remember.exp
diff -u src/usr.bin/make/unit-tests/varmod-remember.exp:1.1 src/usr.bin/make/unit-tests/varmod-remember.exp:1.2
--- src/usr.bin/make/unit-tests/varmod-remember.exp:1.1 Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/varmod-remember.exp Sun Aug 23 15:18:43 2020
@@ -1 +1,3 @@
+1 2 3 1 2 3 1 2 3
+1 2 3, SAVED=3
exit status 0
Index: src/usr.bin/make/unit-tests/varmod-to-upper.exp
diff -u src/usr.bin/make/unit-tests/varmod-to-upper.exp:1.1 src/usr.bin/make/unit-tests/varmod-to-upper.exp:1.2
--- src/usr.bin/make/unit-tests/varmod-to-upper.exp:1.1 Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/varmod-to-upper.exp Sun Aug 23 15:18:43 2020
@@ -1 +1,2 @@
+mod-tu-space: A B
exit status 0
Index: src/usr.bin/make/unit-tests/varmod-remember.mk
diff -u src/usr.bin/make/unit-tests/varmod-remember.mk:1.2 src/usr.bin/make/unit-tests/varmod-remember.mk:1.3
--- src/usr.bin/make/unit-tests/varmod-remember.mk:1.2 Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/varmod-remember.mk Sun Aug 23 15:18:43 2020
@@ -1,9 +1,12 @@
-# $NetBSD: varmod-remember.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varmod-remember.mk,v 1.3 2020/08/23 15:18:43 rillig Exp $
#
# Tests for the :_ modifier, which saves the current variable value
# in the _ variable or another, to be used later again.
-# TODO: Implementation
-
+# In the parameterized form, having the variable name on the right side of
+# the = assignment operator is confusing. In almost all other situations
+# the variable name is on the left-hand side of the = operator. Luckily
+# this modifier is only rarely needed.
all:
- @:;
+ @echo ${1 2 3:L:_:@var@${_}@}
+ @echo ${1 2 3:L:@var@${var:_=SAVED:}@}, SAVED=${SAVED}
Index: src/usr.bin/make/unit-tests/varmod-to-upper.mk
diff -u src/usr.bin/make/unit-tests/varmod-to-upper.mk:1.2 src/usr.bin/make/unit-tests/varmod-to-upper.mk:1.3
--- src/usr.bin/make/unit-tests/varmod-to-upper.mk:1.2 Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/varmod-to-upper.mk Sun Aug 23 15:18:43 2020
@@ -1,9 +1,9 @@
-# $NetBSD: varmod-to-upper.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varmod-to-upper.mk,v 1.3 2020/08/23 15:18:43 rillig Exp $
#
# Tests for the :tu variable modifier, which returns the words in the
# variable value, converted to uppercase.
-# TODO: Implementation
-
-all:
- @:;
+# The :tu and :tl modifiers operate on the variable value as a single string,
+# not as a list of words. Therefore, the adjacent spaces are preserved.
+mod-tu-space:
+ @echo $@: ${a b:L:tu:Q}