aboutsummaryrefslogtreecommitdiff
path: root/contrib/bmake/unit-tests/varmod-edge.mk
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bmake/unit-tests/varmod-edge.mk')
-rw-r--r--contrib/bmake/unit-tests/varmod-edge.mk29
1 files changed, 25 insertions, 4 deletions
diff --git a/contrib/bmake/unit-tests/varmod-edge.mk b/contrib/bmake/unit-tests/varmod-edge.mk
index 762053d281a3..2f8f8c793de1 100644
--- a/contrib/bmake/unit-tests/varmod-edge.mk
+++ b/contrib/bmake/unit-tests/varmod-edge.mk
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-edge.mk,v 1.16 2021/02/23 15:56:30 rillig Exp $
+# $NetBSD: varmod-edge.mk,v 1.20 2024/04/20 10:18:55 rillig Exp $
#
# Tests for edge cases in variable modifiers.
#
@@ -16,7 +16,7 @@ MOD.M-paren= ${INP.M-paren:M(*)}
EXP.M-paren= (parentheses) ()
# The first closing brace matches the opening parenthesis.
-# The second closing brace actually ends the variable expression.
+# The second closing brace actually ends the expression.
#
# XXX: This is unexpected but rarely occurs in practice.
TESTS+= M-mixed
@@ -40,7 +40,7 @@ EXP.M-unescape= \(\{}\):
# as open_parens + open_braces == closing_parens + closing_braces. This
# means that ( and } form a matching pair.
#
-# Nested variable expressions are not parsed as such. Instead, only the
+# Nested expressions are not parsed as such. Instead, only the
# parentheses and braces are counted. This leads to a parse error since
# the nested expression is not "${:U*)}" but only "${:U*)", which is
# missing the closing brace. The expression is evaluated anyway.
@@ -51,7 +51,7 @@ TESTS+= M-nest-mix
INP.M-nest-mix= (parentheses)
MOD.M-nest-mix= ${INP.M-nest-mix:M${:U*)}}
EXP.M-nest-mix= (parentheses)}
-# make: Unclosed variable expression, expecting '}' for modifier "U*)" of variable "" with value "*)"
+# make: Unclosed expression, expecting '}' for modifier "U*)" of variable "" with value "*)"
# In contrast to parentheses and braces, the brackets are not counted
# when the :M modifier is parsed since Makefile variables only take the
@@ -162,7 +162,25 @@ MOD.colons= ${INP.colons::::}
EXP.colons= # empty
.for test in ${TESTS}
+# expect+2: while evaluating variable "MOD.colons": while evaluating variable "INP.colons": Unknown modifier ":"
+# expect+1: while evaluating variable "MOD.colons": while evaluating variable "INP.colons": Unknown modifier ":"
. if ${MOD.${test}} == ${EXP.${test}}
+# expect+16: ok M-paren
+# expect+15: ok M-mixed
+# expect+14: ok M-unescape
+# expect+13: ok M-nest-mix
+# expect+12: ok M-nest-brk
+# expect+11: ok M-pat-err
+# expect+10: ok M-bsbs
+# expect+09: ok M-bs1-par
+# expect+08: ok M-bs2-par
+# expect+07: ok M-128
+# expect+06: ok eq-ext
+# expect+05: ok eq-q
+# expect+04: ok eq-bs
+# expect+03: ok eq-esc
+# expect+02: ok colon
+# expect+01: ok colons
. info ok ${test}
. else
. warning error in ${test}: expected "${EXP.${test}}", got "${MOD.${test}}"
@@ -172,6 +190,8 @@ EXP.colons= # empty
# Even in expressions based on an unnamed variable, there may be errors.
# XXX: The error message should mention the variable name of the expression,
# even though that name is empty in this case.
+# expect+2: Malformed conditional (${:Z})
+# expect+1: while evaluating "${:Z}": Unknown modifier "Z"
.if ${:Z}
. error
.else
@@ -185,6 +205,7 @@ EXP.colons= # empty
# modifier for (',' missing)", having two spaces in a row.
#
# XXX: The error message should report the filename:lineno.
+# expect+1: Malformed conditional (${:S,})
.if ${:S,}
. error
.else