summaryrefslogtreecommitdiffstats
path: root/contrib/bmake/unit-tests/varmisc.mk
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bmake/unit-tests/varmisc.mk')
-rw-r--r--contrib/bmake/unit-tests/varmisc.mk42
1 files changed, 42 insertions, 0 deletions
diff --git a/contrib/bmake/unit-tests/varmisc.mk b/contrib/bmake/unit-tests/varmisc.mk
new file mode 100644
index 0000000..14b52d2
--- /dev/null
+++ b/contrib/bmake/unit-tests/varmisc.mk
@@ -0,0 +1,42 @@
+# $Id: varmisc.mk,v 1.5 2015/10/12 17:10:48 sjg Exp $
+#
+# Miscellaneous variable tests.
+
+all: unmatched_var_paren D_true U_true D_false U_false Q_lhs Q_rhs NQ_none
+
+unmatched_var_paren:
+ @echo ${foo::=foo-text}
+
+True = ${echo true >&2:L:sh}TRUE
+False= ${echo false >&2:L:sh}FALSE
+
+VSET= is set
+.undef UNDEF
+
+U_false:
+ @echo :U skipped when var set
+ @echo ${VSET:U${False}}
+
+D_false:
+ @echo :D skipped if var undef
+ @echo ${UNDEF:D${False}}
+
+U_true:
+ @echo :U expanded when var undef
+ @echo ${UNDEF:U${True}}
+
+D_true:
+ @echo :D expanded when var set
+ @echo ${VSET:D${True}}
+
+Q_lhs:
+ @echo :? only lhs when value true
+ @echo ${1:L:?${True}:${False}}
+
+Q_rhs:
+ @echo :? only rhs when value false
+ @echo ${0:L:?${True}:${False}}
+
+NQ_none:
+ @echo do not evaluate or expand :? if discarding
+ @echo ${VSET:U${1:L:?${True}:${False}}}
OpenPOWER on IntegriCloud