aboutsummaryrefslogtreecommitdiff
path: root/contrib/bmake/unit-tests/varmod-range.mk
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bmake/unit-tests/varmod-range.mk')
-rw-r--r--contrib/bmake/unit-tests/varmod-range.mk26
1 files changed, 19 insertions, 7 deletions
diff --git a/contrib/bmake/unit-tests/varmod-range.mk b/contrib/bmake/unit-tests/varmod-range.mk
index 86ef11a59eaf..920001096054 100644
--- a/contrib/bmake/unit-tests/varmod-range.mk
+++ b/contrib/bmake/unit-tests/varmod-range.mk
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-range.mk,v 1.8 2023/06/01 20:56:35 rillig Exp $
+# $NetBSD: varmod-range.mk,v 1.10 2023/12/17 14:07:22 rillig Exp $
#
# Tests for the :range variable modifier, which generates sequences
# of integers from the given range.
@@ -7,7 +7,7 @@
# modword.mk
# The :range modifier generates a sequence of integers, one number per
-# word of the variable expression's value.
+# word of the expression's value.
.if ${a b c:L:range} != "1 2 3"
. error
.endif
@@ -19,20 +19,32 @@
.endif
# The :range modifier takes the number of words from the value of the
-# variable expression. If that expression is undefined, the range is
+# expression. If that expression is undefined, the range is
# undefined as well. This should not come as a surprise.
.if "${:range}" != ""
. error
.endif
+# An empty expression results in a sequence of a single number, even though
+# the expression contains 0 words.
+.if ${:U:range} != "1"
+. error
+.endif
+
# The :range modifier can be given a parameter, which makes the generated
-# range independent from the value or the name of the variable expression.
-#
-# XXX: As of 2020-09-27, the :range=... modifier does not turn the undefined
-# expression into a defined one. This looks like an oversight.
+# range independent from the value or the name of the expression.
.if "${:range=5}" != ""
. error
.endif
+# XXX: As of 2023-12-17, the ':range=n' modifier does not turn the undefined
+# expression into a defined one, even though it does not depend on the value
+# of the expression. This looks like an oversight.
+# expect+1: Malformed conditional (${:range=5} != "")
+.if ${:range=5} != ""
+. error
+.else
+. error
+.endif
# Negative ranges don't make sense.
# As of 2020-11-01, they are accepted though, using up all available memory.