xref: /freebsd/contrib/bmake/unit-tests/varmod-l-name-to-value.mk (revision 96474d2a3fa895fb9636183403fc8ca7ccf60216)
1# $NetBSD: varmod-l-name-to-value.mk,v 1.3 2020/08/25 22:25:05 rillig Exp $
2#
3# Tests for the :L modifier, which returns the variable name as the new value.
4
5# The empty variable name leads to an empty string.
6.if ${:L} != ""
7.error
8.endif
9
10# The variable name is converted into an expression with the variable name
11# "VARNAME" and the value "VARNAME".
12.if ${VARNAME:L} != "VARNAME"
13.error
14.endif
15
16# The value of the expression can be modified afterwards.
17.if ${VARNAME:L:S,VAR,,} != "NAME"
18.error
19.endif
20
21# The name of the expression is still the same as before. Using the :L
22# modifier, it can be restored.
23#
24# Hmmm, this can be used as a double storage or a backup mechanism.
25# Probably unintended, but maybe useful.
26.if ${VARNAME:L:S,VAR,,:L} != "VARNAME"
27.error
28.endif
29
30all:
31	@:;
32