about summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2021-11-12 20:33:52 +0100
committerOliver Kiddle <opk@zsh.org>2021-11-12 20:33:52 +0100
commitdfb7ac94bb4c28472d759a61ea3c2dab30cf9cd3 (patch)
tree1894d81725e4825c1b1948c0ccf1236b439e3710 /Test
parent631576de0f7b4e52487175e3e017e5136424b626 (diff)
downloadzsh-dfb7ac94bb4c28472d759a61ea3c2dab30cf9cd3.tar.gz
zsh-dfb7ac94bb4c28472d759a61ea3c2dab30cf9cd3.tar.xz
zsh-dfb7ac94bb4c28472d759a61ea3c2dab30cf9cd3.zip
49561: add zformat -F option, similar to -f but ternary expressions check for existence instead of doing math evaluation
Diffstat (limited to 'Test')
-rw-r--r--Test/V13zformat.ztst24
1 files changed, 24 insertions, 0 deletions
diff --git a/Test/V13zformat.ztst b/Test/V13zformat.ztst
index 982866e13..035a0a495 100644
--- a/Test/V13zformat.ztst
+++ b/Test/V13zformat.ztst
@@ -58,6 +58,30 @@
 0:nested conditionals test
 >yes
 
+ () {
+   zformat -f 1 '%(w.zero.fail) %(x.fail.present) %(y.empty.fail) %(z.missing.fail)' w:0 x:1 y:
+   zformat -F 2 '%(w.zero.fail) %(x.present.fail) %(y.fail.empty) %(z.fail.missing)' w:0 x:1 y:
+   echo $1
+   echo $2
+ }
+0:conditionals with empty and missing values
+>zero present empty missing
+>zero present empty missing
+
+ () {
+   local l
+   for l in 0 1 2 3; do
+     zformat -F 1 "%$l(a.a.A)%$l(b.b.B)%$l(c.c.C)%$l(d.d.D)" a: b:1 c:12 d:123
+     zformat -F 2 "%-$l(a.a.A)%-$l(b.b.B)%-$l(c.c.C)%-$l(d.d.D)" a: b:1 c:12 d:123
+     print - $1 $2
+   done
+ }
+0:minimum and maximum widths
+>Abcd aBCD
+>ABcd abCD
+>ABCd abcD
+>ABCD abcd
+
  zformat -a argv . foo:lorem ipsum:bar bazbaz '\\esc\:ape'
  print -rl -- "$@"
 0:basic -a test