about summary refs log tree commit diff
path: root/Test/D04parameter.ztst
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-10-06 08:27:09 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-10-06 08:27:09 +0000
commit8aac69241f5882e379509b3688c2f8e78cc71171 (patch)
tree9a9c55d028849a8ef024e343f3ab27848431d72f /Test/D04parameter.ztst
parent22899d3788d5eb8bad9440f2f0886170bb7ca61d (diff)
downloadzsh-8aac69241f5882e379509b3688c2f8e78cc71171.tar.gz
zsh-8aac69241f5882e379509b3688c2f8e78cc71171.tar.xz
zsh-8aac69241f5882e379509b3688c2f8e78cc71171.zip
28319: (z) splitting oddities
Diffstat (limited to 'Test/D04parameter.ztst')
-rw-r--r--Test/D04parameter.ztst28
1 files changed, 28 insertions, 0 deletions
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index 4594e62fd..fe978263f 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -389,6 +389,34 @@
 >)
 >ten( more
 
+  strings=(
+    'foo=(1 2 3)'
+    '(( 3 + 1 == 8 / 2 ))'
+    'for (( i = 1 ; i < 10 ; i++ ))'
+  )
+  for string in $strings; do
+    array=(${(z)string})
+    for (( i = 1; i <= ${#array}; i++ )); do
+      print -r -- "${i}:${array[i]}:"
+    done
+  done
+0:Some syntactical expressions that are hard to split into words with (z).
+>1:foo=(:
+>2:1:
+>3:2:
+>4:3:
+>5:):
+>1:(( 3 + 1 == 8 / 2 )):
+>1:for:
+>2:((:
+# Leading whitespace is removed, because the word proper hasn't started;
+# trailing whitespace is left because the word is terminated by the
+# semicolon or double parentheses.  Bit confusing but sort of consistent.
+>3:i = 1 ;:
+>4:i < 10 ;:
+>5:i++ :
+>6:)):
+
   psvar=(dog)
   setopt promptsubst
   foo='It shouldn'\''t $(happen) to a %1v.'