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): add test for expanding vari...
details: https://anonhg.NetBSD.org/src/rev/e5df10423ea4
branches: trunk
changeset: 1016116:e5df10423ea4
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Nov 08 16:44:47 2020 +0000
description:
make(1): add test for expanding variable expressions
diffstat:
distrib/sets/lists/tests/mi | 4 ++-
usr.bin/make/unit-tests/Makefile | 3 +-
usr.bin/make/unit-tests/varparse-errors.exp | 1 +
usr.bin/make/unit-tests/varparse-errors.mk | 35 +++++++++++++++++++++++++++++
4 files changed, 41 insertions(+), 2 deletions(-)
diffs (79 lines):
diff -r 4209e7b3975c -r e5df10423ea4 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi Sun Nov 08 15:57:01 2020 +0000
+++ b/distrib/sets/lists/tests/mi Sun Nov 08 16:44:47 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.963 2020/11/08 02:33:18 rillig Exp $
+# $NetBSD: mi,v 1.964 2020/11/08 16:44:47 rillig Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -5499,6 +5499,8 @@
./usr/tests/usr.bin/make/unit-tests/varname.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/varparse-dynamic.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/varparse-dynamic.mk tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/varparse-errors.exp tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/varparse-errors.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/varparse-mod.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/varparse-mod.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/varparse-undef-partial.exp tests-usr.bin-tests compattestfile,atf
diff -r 4209e7b3975c -r e5df10423ea4 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile Sun Nov 08 15:57:01 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile Sun Nov 08 16:44:47 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.190 2020/11/07 23:25:06 rillig Exp $
+# $NetBSD: Makefile,v 1.191 2020/11/08 16:44:47 rillig Exp $
#
# Unit tests for make(1)
#
@@ -371,6 +371,7 @@
TESTS+= varname-pwd
TESTS+= varname-vpath
TESTS+= varparse-dynamic
+TESTS+= varparse-errors
TESTS+= varparse-mod
TESTS+= varparse-undef-partial
TESTS+= varquote
diff -r 4209e7b3975c -r e5df10423ea4 usr.bin/make/unit-tests/varparse-errors.exp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/varparse-errors.exp Sun Nov 08 16:44:47 2020 +0000
@@ -0,0 +1,1 @@
+exit status 0
diff -r 4209e7b3975c -r e5df10423ea4 usr.bin/make/unit-tests/varparse-errors.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/varparse-errors.mk Sun Nov 08 16:44:47 2020 +0000
@@ -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:
Home |
Main Index |
Thread Index |
Old Index