xref: /freebsd/contrib/bmake/unit-tests/varmisc.mk (revision 39ee7a7a6bdd1557b1c3532abf60d139798ac88b)
1# $Id: varmisc.mk,v 1.5 2015/10/12 17:10:48 sjg Exp $
2#
3# Miscellaneous variable tests.
4
5all: unmatched_var_paren D_true U_true D_false U_false Q_lhs Q_rhs NQ_none
6
7unmatched_var_paren:
8	@echo ${foo::=foo-text}
9
10True = ${echo true >&2:L:sh}TRUE
11False= ${echo false >&2:L:sh}FALSE
12
13VSET= is set
14.undef UNDEF
15
16U_false:
17	@echo :U skipped when var set
18	@echo ${VSET:U${False}}
19
20D_false:
21	@echo :D skipped if var undef
22	@echo ${UNDEF:D${False}}
23
24U_true:
25	@echo :U expanded when var undef
26	@echo ${UNDEF:U${True}}
27
28D_true:
29	@echo :D expanded when var set
30	@echo ${VSET:D${True}}
31
32Q_lhs:
33	@echo :? only lhs when value true
34	@echo ${1:L:?${True}:${False}}
35
36Q_rhs:
37	@echo :? only rhs when value false
38	@echo ${0:L:?${True}:${False}}
39
40NQ_none:
41	@echo do not evaluate or expand :? if discarding
42	@echo ${VSET:U${1:L:?${True}:${False}}}
43