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): clean up unit tests
details: https://anonhg.NetBSD.org/src/rev/ccc4d35492d3
branches: trunk
changeset: 1015911:ccc4d35492d3
user: rillig <rillig%NetBSD.org@localhost>
date: Tue Nov 03 18:42:33 2020 +0000
description:
make(1): clean up unit tests
diffstat:
usr.bin/make/unit-tests/dir.mk | 5 +++--
usr.bin/make/unit-tests/modmisc.mk | 10 +++++-----
usr.bin/make/unit-tests/modts.mk | 5 ++---
usr.bin/make/unit-tests/varmod-exclam-shell.mk | 23 ++++++++++++++++-------
4 files changed, 26 insertions(+), 17 deletions(-)
diffs (110 lines):
diff -r 2d26aa9b2cef -r ccc4d35492d3 usr.bin/make/unit-tests/dir.mk
--- a/usr.bin/make/unit-tests/dir.mk Tue Nov 03 18:21:36 2020 +0000
+++ b/usr.bin/make/unit-tests/dir.mk Tue Nov 03 18:42:33 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: dir.mk,v 1.7 2020/10/31 21:30:03 rillig Exp $
+# $NetBSD: dir.mk,v 1.8 2020/11/03 18:42:33 rillig Exp $
#
# Tests for dir.c.
@@ -64,7 +64,8 @@
: $@
# The expansions may have duplicates.
-# These are merged together because of the dependency line.
+# When the source of the dependency line is expanded later, each of the
+# expanded words will be the same.
all: dup-{1,1,1,1,1,1,1}
dup-1:
diff -r 2d26aa9b2cef -r ccc4d35492d3 usr.bin/make/unit-tests/modmisc.mk
--- a/usr.bin/make/unit-tests/modmisc.mk Tue Nov 03 18:21:36 2020 +0000
+++ b/usr.bin/make/unit-tests/modmisc.mk Tue Nov 03 18:42:33 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: modmisc.mk,v 1.49 2020/10/24 08:50:17 rillig Exp $
+# $NetBSD: modmisc.mk,v 1.50 2020/11/03 18:42:33 rillig Exp $
#
# miscellaneous modifier tests
@@ -48,9 +48,9 @@
@echo @:${:@var@${var}@}
# The :U modifier turns even the "" variable into something that has a value.
-# The resulting variable is empty, but is still considered to contain a
-# single empty word. This word can be accessed by the :S and :C modifiers,
-# but not by the :@ modifier since it explicitly skips empty words.
+# The value of the resulting expression is empty, but is still considered to
+# contain a single empty word. This word can be accessed by the :S and :C
+# modifiers, but not by the :@ modifier since it explicitly skips empty words.
undefvar:
@echo S:${:U:S,^$,empty,}
@echo C:${:U:C,^$,empty,}
@@ -65,7 +65,7 @@
@echo $@: ${UNDEF:U:range=500:[#]}
# To apply a modifier indirectly via another variable, the whole
-# modifier must be put into a single variable.
+# modifier must be put into a single variable expression.
.if ${value:L:${:US}${:U,value,replacement,}} != "S,value,replacement,}"
. warning unexpected
.endif
diff -r 2d26aa9b2cef -r ccc4d35492d3 usr.bin/make/unit-tests/modts.mk
--- a/usr.bin/make/unit-tests/modts.mk Tue Nov 03 18:21:36 2020 +0000
+++ b/usr.bin/make/unit-tests/modts.mk Tue Nov 03 18:42:33 2020 +0000
@@ -1,7 +1,6 @@
-# $NetBSD: modts.mk,v 1.7 2020/10/24 08:50:17 rillig Exp $
+# $NetBSD: modts.mk,v 1.8 2020/11/03 18:42:33 rillig Exp $
-LIST= one two three
-LIST+= four five six
+LIST= one two three four five six
FU_mod-ts= a / b / cool
diff -r 2d26aa9b2cef -r ccc4d35492d3 usr.bin/make/unit-tests/varmod-exclam-shell.mk
--- a/usr.bin/make/unit-tests/varmod-exclam-shell.mk Tue Nov 03 18:21:36 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-exclam-shell.mk Tue Nov 03 18:42:33 2020 +0000
@@ -1,27 +1,36 @@
-# $NetBSD: varmod-exclam-shell.mk,v 1.3 2020/10/24 08:46:08 rillig Exp $
+# $NetBSD: varmod-exclam-shell.mk,v 1.4 2020/11/03 18:42:33 rillig Exp $
#
-# Tests for the :!cmd! variable modifier.
+# Tests for the :!cmd! variable modifier, which evaluates the modifier
+# argument, independent of the value or the name of the original variable.
.if ${:!echo hello | tr 'l' 'l'!} != "hello"
-. warning unexpected
+. error
.endif
# The output is truncated at the first null byte.
# Cmd_Exec returns only a string pointer without length information.
+# Truncating the output is not necessarily intended but may also be a side
+# effect from the implementation. Having null bytes in the output of a
+# shell command is so unusual that it doesn't matter in practice.
.if ${:!echo hello | tr 'l' '\0'!} != "he"
-. warning unexpected
+. error
.endif
+# The newline at the end of the output is stripped.
.if ${:!echo!} != ""
-. warning A newline at the end of the output must be stripped.
+. error
.endif
+# Only the final newline of the output is stripped. All other newlines are
+# converted to spaces.
.if ${:!echo;echo!} != " "
-. warning Only a single newline at the end of the output is stripped.
+. error
.endif
+# Each newline in the output is converted to a space, except for the newline
+# at the end of the output, which is stripped.
.if ${:!echo;echo;echo;echo!} != " "
-. warning Other newlines in the output are converted to spaces.
+. error
.endif
all:
Home |
Main Index |
Thread Index |
Old Index