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