about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWayne Davison <wayned@users.sourceforge.net>2000-06-02 09:29:00 +0000
committerWayne Davison <wayned@users.sourceforge.net>2000-06-02 09:29:00 +0000
commit66f58fc6fdd10a002db966e6c6513b4b5855af26 (patch)
treefcfd018a756794bda062147c48f03231c3b8c77f
parent323c72520a2ae42bc4e8b4d7c5c2279e2a5f24d5 (diff)
downloadzsh-66f58fc6fdd10a002db966e6c6513b4b5855af26.tar.gz
zsh-66f58fc6fdd10a002db966e6c6513b4b5855af26.tar.xz
zsh-66f58fc6fdd10a002db966e6c6513b4b5855af26.zip
Improved the comment lines & added some "ksh_arrays" tests.
-rw-r--r--Test/14array.ztst66
1 files changed, 44 insertions, 22 deletions
diff --git a/Test/14array.ztst b/Test/14array.ztst
index 7ff5fe13d..87f22eff4 100644
--- a/Test/14array.ztst
+++ b/Test/14array.ztst
@@ -6,50 +6,72 @@
 
 %test
 
+  echo .$foo[1].
+0:The first element
+>.a.
+
   echo .$foo[1,4].
-0:Array indexing
+0:Normal multi-item indexing
 >.a b c d.
 
-  echo .$foo[1,-5].
-0:Array indexing
->.a b c.
+  echo .$foo[1,0].
+0:This should be empty
+>..
 
   echo .$foo[4,1].
-0:Array indexing
+0:Another empty slice
 >..
 
-  echo .$foo[0,0].
-0:Array indexing
->.a.
+  echo .$foo[1,-8].
+0:An empty slice with a negative length
+>..
 
   echo .$foo[0].
-0:Array indexing
+0:Treat 0 like 1
 >.a.
 
-  echo .$foo[1].
-0:Array indexing
+  echo .$foo[0,0].
+0:Treat 0,0 like 1,1.
 >.a.
 
-  echo .$foo[3].
-0:Array indexing
->.c.
-
   echo .$foo[0,1].
-0:Array indexing
+0:Another weird way to access the first element
 >.a.
 
+  echo .$foo[3].
+0:An inner element
+>.c.
+
   echo .$foo[2,2].
-0:Array indexing
+0:Another inner element
 >.b.
 
-  echo .$foo[1,0].
-0:Array indexing
->..
+  echo .$foo[2,-4].
+0:A slice with a negative length
+>.b c d.
 
   echo .$foo[-4,5].
-0:Array indexing
+0:A slice with a negative start
 >.d e.
 
   echo .$foo[-6,-2].
-0:Array indexing
+0:A slice with both items negative
 >.b c d e f.
+
+  setopt ksh_arrays
+  echo .${foo[1,2]}.
+  unsetopt ksh_arrays
+0:Ksh array indexing
+>.b c.
+
+  setopt ksh_arrays
+  echo .${foo[0,1]}.
+  unsetopt ksh_arrays
+0:Ksh array indexing (ii)
+>.a b.
+
+  setopt ksh_arrays
+  echo .${foo[1,-1]}.
+  unsetopt ksh_arrays
+0:Ksh array indexing (iii)
+>.b c d e f g.