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 tests for parsing the S...
details: https://anonhg.NetBSD.org/src/rev/a9d0689082d2
branches: trunk
changeset: 945600:a9d0689082d2
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Nov 01 22:10:57 2020 +0000
description:
make(1): add tests for parsing the SysV variable modifier
diffstat:
usr.bin/make/unit-tests/varmod-sysv.exp | 6 +++++-
usr.bin/make/unit-tests/varmod-sysv.mk | 21 ++++++++++++++++++++-
2 files changed, 25 insertions(+), 2 deletions(-)
diffs (45 lines):
diff -r 862424c9dbdc -r a9d0689082d2 usr.bin/make/unit-tests/varmod-sysv.exp
--- a/usr.bin/make/unit-tests/varmod-sysv.exp Sun Nov 01 21:28:42 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-sysv.exp Sun Nov 01 22:10:57 2020 +0000
@@ -1,1 +1,5 @@
-exit status 0
+make: Unfinished modifier for word203 ('=' missing)
+make: "varmod-sysv.mk" line 203: Malformed conditional (${word203:L:from${:D=}to})
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1
diff -r 862424c9dbdc -r a9d0689082d2 usr.bin/make/unit-tests/varmod-sysv.mk
--- a/usr.bin/make/unit-tests/varmod-sysv.mk Sun Nov 01 21:28:42 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-sysv.mk Sun Nov 01 22:10:57 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-sysv.mk,v 1.9 2020/10/31 11:06:24 rillig Exp $
+# $NetBSD: varmod-sysv.mk,v 1.10 2020/11/01 22:10:57 rillig Exp $
#
# Tests for the ${VAR:from=to} variable modifier, which replaces the suffix
# "from" with "to". It can also use '%' as a wildcard.
@@ -196,6 +196,25 @@
. error
.endif
+# This is not a SysV modifier since the nested variable expression expands
+# to an empty string. The '=' in it should be irrelevant during parsing.
+# As of 2020-11-01, this seemingly correct modifier leads to a parse error.
+# XXX
+.if ${word203:L:from${:D=}to}
+. error
+.endif
+
+# XXX: This specially constructed case demonstrates that the SysV modifier
+# lasts longer than expected. The whole expression initially has the value
+# "fromto}...". The next modifier is a SysV modifier. ApplyModifier_SysV
+# parses the modifier as "from${:D=}to", ending at the '}'. Next, the two
+# parts of the modifier are parsed using ParseModifierPart, which scans
+# differently, properly handling nested variable expressions. The two parts
+# are now "fromto}..." and "replaced".
+.if "${:Ufromto\}...:from${:D=}to}...=replaced}" != "replaced"
+. error
+.endif
+
# As of 2020-10-06, the right-hand side of the SysV modifier is expanded
# twice. The first expansion happens in ApplyModifier_SysV, where the
# modifier is split into its two parts. The second expansion happens
Home |
Main Index |
Thread Index |
Old Index