summaryrefslogtreecommitdiff
path: root/unit-tests/varparse-errors.mk
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2020-11-20 03:54:37 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2020-11-20 03:54:37 +0000
commit1b65f0bd2bda7121a90f8cb4c1cacaa20f1b681d (patch)
tree90c374b8513ec5109e1ec4e2228e2edf648e8756 /unit-tests/varparse-errors.mk
parent302da1a3d35c15cb29d76e0a939f8bcb13f7ad80 (diff)
Notes
Diffstat (limited to 'unit-tests/varparse-errors.mk')
-rw-r--r--unit-tests/varparse-errors.mk35
1 files changed, 35 insertions, 0 deletions
diff --git a/unit-tests/varparse-errors.mk b/unit-tests/varparse-errors.mk
new file mode 100644
index 000000000000..42f5b65a728e
--- /dev/null
+++ b/unit-tests/varparse-errors.mk
@@ -0,0 +1,35 @@
+# $NetBSD: varparse-errors.mk,v 1.1 2020/11/08 16:44:47 rillig Exp $
+
+# Tests for parsing and evaluating all kinds of variable expressions.
+#
+# This is the basis for redesigning the error handling in Var_Parse and
+# Var_Subst, collecting typical and not so typical use cases.
+#
+# See also:
+# VarParseResult
+# Var_Parse
+# Var_Subst
+
+PLAIN= plain value
+
+LITERAL_DOLLAR= To get a dollar, double $$ it.
+
+INDIRECT= An ${:Uindirect} value.
+
+REF_UNDEF= A reference to an ${UNDEF}undefined variable.
+
+ERR_UNCLOSED= An ${UNCLOSED variable expression.
+
+ERR_BAD_MOD= An ${:Uindirect:Z} expression with an unknown modifier.
+
+ERR_EVAL= An evaluation error ${:Uvalue:C,.,\3,}.
+
+# In a conditional, a variable expression that is not enclosed in quotes is
+# expanded using the flags VARE_UNDEFERR and VARE_WANTRES.
+# The variable itself must be defined.
+# It may refer to undefined variables though.
+.if ${REF_UNDEF} != "A reference to an undefined variable."
+. error
+.endif
+
+all: