summaryrefslogtreecommitdiffstats
path: root/contrib/bmake/unit-tests
diff options
context:
space:
mode:
authorsjg <sjg@FreeBSD.org>2015-10-23 17:38:01 +0000
committersjg <sjg@FreeBSD.org>2015-10-23 17:38:01 +0000
commita1cf517b9773cdac110ae2e070a8b6a211054302 (patch)
tree90f609aa8fbb06b6220e1227adcc383d6ee1e5c4 /contrib/bmake/unit-tests
parent495cadb99fd3b99f7ac1a08451c84940d3fb747a (diff)
parentfc737f02d4dbedb056bf90a3107fd7c5af012f0f (diff)
downloadFreeBSD-src-a1cf517b9773cdac110ae2e070a8b6a211054302.zip
FreeBSD-src-a1cf517b9773cdac110ae2e070a8b6a211054302.tar.gz
Merge bmake 20151020
Diffstat (limited to 'contrib/bmake/unit-tests')
-rw-r--r--contrib/bmake/unit-tests/varmisc.exp18
-rw-r--r--contrib/bmake/unit-tests/varmisc.mk38
2 files changed, 54 insertions, 2 deletions
diff --git a/contrib/bmake/unit-tests/varmisc.exp b/contrib/bmake/unit-tests/varmisc.exp
index 1636aaf..e2af496 100644
--- a/contrib/bmake/unit-tests/varmisc.exp
+++ b/contrib/bmake/unit-tests/varmisc.exp
@@ -1,2 +1,20 @@
+:D expanded when var set
+true
+TRUE
+:U expanded when var undef
+true
+TRUE
+:D skipped if var undef
+
+:U skipped when var set
+is set
+:? only lhs when value true
+true
+TRUE
+:? only rhs when value false
+false
+FALSE
+do not evaluate or expand :? if discarding
+is set
exit status 0
diff --git a/contrib/bmake/unit-tests/varmisc.mk b/contrib/bmake/unit-tests/varmisc.mk
index 4b4a931..14b52d2 100644
--- a/contrib/bmake/unit-tests/varmisc.mk
+++ b/contrib/bmake/unit-tests/varmisc.mk
@@ -1,8 +1,42 @@
-# $Id: varmisc.mk,v 1.2 2014/08/30 22:25:14 sjg Exp $
+# $Id: varmisc.mk,v 1.5 2015/10/12 17:10:48 sjg Exp $
#
# Miscellaneous variable tests.
-all: unmatched_var_paren
+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