summaryrefslogtreecommitdiff
path: root/unit-tests/varmisc.mk
diff options
context:
space:
mode:
Diffstat (limited to 'unit-tests/varmisc.mk')
-rw-r--r--unit-tests/varmisc.mk24
1 files changed, 22 insertions, 2 deletions
diff --git a/unit-tests/varmisc.mk b/unit-tests/varmisc.mk
index 14b52d22c3e6b..a0b8f2dc84f4c 100644
--- a/unit-tests/varmisc.mk
+++ b/unit-tests/varmisc.mk
@@ -1,8 +1,9 @@
-# $Id: varmisc.mk,v 1.5 2015/10/12 17:10:48 sjg Exp $
+# $Id: varmisc.mk,v 1.9 2017/02/01 18:44:54 sjg Exp $
#
# Miscellaneous variable tests.
-all: unmatched_var_paren D_true U_true D_false U_false Q_lhs Q_rhs NQ_none
+all: unmatched_var_paren D_true U_true D_false U_false Q_lhs Q_rhs NQ_none \
+ strftime cmpv
unmatched_var_paren:
@echo ${foo::=foo-text}
@@ -40,3 +41,22 @@ Q_rhs:
NQ_none:
@echo do not evaluate or expand :? if discarding
@echo ${VSET:U${1:L:?${True}:${False}}}
+
+April1= 1459494000
+
+# slightly contorted syntax to use utc via variable
+strftime:
+ @echo ${year=%Y month=%m day=%d:L:gmtime=1459494000}
+ @echo date=${%Y%m%d:L:${gmtime=${April1}:L}}
+
+# big jumps to handle 3 digits per step
+M_cmpv.units = 1 1000 1000000
+M_cmpv = S,., ,g:_:range:@i@+ $${_:[-$$i]} \* $${M_cmpv.units:[$$i]}@:S,^,expr 0 ,1:sh
+
+Version = 123.456.789
+cmpv.only = target specific vars
+
+cmpv:
+ @echo Version=${Version} == ${Version:${M_cmpv}}
+ @echo Literal=3.4.5 == ${3.4.5:L:${M_cmpv}}
+ @echo We have ${${.TARGET:T}.only}