Sun Jul 26 21:09:49 2020 UTC ()
make(1): add test for unclosed variables


(rillig)
diff -r1.11 -r1.12 src/usr.bin/make/unit-tests/varmisc.exp
diff -r1.15 -r1.16 src/usr.bin/make/unit-tests/varmisc.mk

cvs diff -r1.11 -r1.12 src/usr.bin/make/unit-tests/varmisc.exp (expand / switch to unified diff)

--- src/usr.bin/make/unit-tests/varmisc.exp 2020/07/26 20:30:42 1.11
+++ src/usr.bin/make/unit-tests/varmisc.exp 2020/07/26 21:09:49 1.12
@@ -34,14 +34,20 @@ save-dollars: Yes = $$ @@ -34,14 +34,20 @@ save-dollars: Yes = $$
34save-dollars: No = $ 34save-dollars: No = $
35save-dollars: yes = $$ 35save-dollars: yes = $$
36save-dollars: no = $ 36save-dollars: no = $
37save-dollars: On = $$ 37save-dollars: On = $$
38save-dollars: Off = $ 38save-dollars: Off = $
39save-dollars: ON = $$ 39save-dollars: ON = $$
40save-dollars: OFF = $ 40save-dollars: OFF = $
41save-dollars: on = $$ 41save-dollars: on = $$
42save-dollars: off = $ 42save-dollars: off = $
43export-appended: env 43export-appended: env
44export-appended: env 44export-appended: env
45export-appended: env mk 45export-appended: env mk
46parse-dynamic: parse-dynamic parse-dynamic before 46parse-dynamic: parse-dynamic parse-dynamic before
 47varerror-unclosed:begin
 48
 49make: Unclosed variable specification (expecting '}') for "UNCLOSED" (value "") modifier M
 50
 51
 52varerror-unclosed:end
47exit status 0 53exit status 0

cvs diff -r1.15 -r1.16 src/usr.bin/make/unit-tests/varmisc.mk (expand / switch to unified diff)

--- src/usr.bin/make/unit-tests/varmisc.mk 2020/07/26 20:30:42 1.15
+++ src/usr.bin/make/unit-tests/varmisc.mk 2020/07/26 21:09:49 1.16
@@ -1,22 +1,23 @@ @@ -1,22 +1,23 @@
1# $Id: varmisc.mk,v 1.15 2020/07/26 20:30:42 rillig Exp $ 1# $Id: varmisc.mk,v 1.16 2020/07/26 21:09:49 rillig Exp $
2# 2#
3# Miscellaneous variable tests. 3# Miscellaneous variable tests.
4 4
5all: unmatched_var_paren D_true U_true D_false U_false Q_lhs Q_rhs NQ_none \ 5all: unmatched_var_paren D_true U_true D_false U_false Q_lhs Q_rhs NQ_none \
6 strftime cmpv manok 6 strftime cmpv manok
7all: save-dollars 7all: save-dollars
8all: export-appended 8all: export-appended
9all: parse-dynamic 9all: parse-dynamic
 10all: varerror-unclosed
10 11
11unmatched_var_paren: 12unmatched_var_paren:
12 @echo ${foo::=foo-text} 13 @echo ${foo::=foo-text}
13 14
14True = ${echo true >&2:L:sh}TRUE 15True = ${echo true >&2:L:sh}TRUE
15False= ${echo false >&2:L:sh}FALSE 16False= ${echo false >&2:L:sh}FALSE
16 17
17VSET= is set 18VSET= is set
18.undef UNDEF 19.undef UNDEF
19 20
20U_false: 21U_false:
21 @echo :U skipped when var set 22 @echo :U skipped when var set
22 @echo ${VSET:U${False}} 23 @echo ${VSET:U${False}}
@@ -164,13 +165,22 @@ export-appended: @@ -164,13 +165,22 @@ export-appended:
164# the global context. They are preserved until there is a local context 165# the global context. They are preserved until there is a local context
165# in which resolving them makes sense. 166# in which resolving them makes sense.
166 167
167${:U>}= before 168${:U>}= before
168G_TARGET:= $@ 169G_TARGET:= $@
169G_MEMBER:= $% 170G_MEMBER:= $%
170G_PREFIX:= $* 171G_PREFIX:= $*
171G_ARCHIVE:= $! 172G_ARCHIVE:= $!
172G_ALLSRC:= $> 173G_ALLSRC:= $>
173${:U>}= after 174${:U>}= after
174 175
175parse-dynamic: 176parse-dynamic:
176 @echo $@: ${G_TARGET} ${G_MEMBER} ${G_PREFIX} ${G_ARCHIVE} ${G_ALLSRC} 177 @echo $@: ${G_TARGET} ${G_MEMBER} ${G_PREFIX} ${G_ARCHIVE} ${G_ALLSRC}
 178
 179# As of 2020-07-26, make does not complain about unclosed variables.
 180# It does complain about unclosed variables when parsing modifiers though.
 181varerror-unclosed:
 182 @echo $@:begin
 183 @echo ${UNCLOSED
 184 @echo ${UNCLOSED:M${PATTERN
 185 @echo ${UNCLOSED.${param
 186 @echo $@:end