1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-11-19 13:33:52 +01:00

Improved the comment lines & added some "ksh_arrays" tests.

This commit is contained in:
Wayne Davison 2000-06-02 09:29:00 +00:00
parent 323c72520a
commit 66f58fc6fd

@ -6,50 +6,72 @@
%test %test
echo .$foo[1].
0:The first element
>.a.
echo .$foo[1,4]. echo .$foo[1,4].
0:Array indexing 0:Normal multi-item indexing
>.a b c d. >.a b c d.
echo .$foo[1,-5]. echo .$foo[1,0].
0:Array indexing 0:This should be empty
>.a b c.
echo .$foo[4,1].
0:Array indexing
>.. >..
echo .$foo[0,0]. echo .$foo[4,1].
0:Array indexing 0:Another empty slice
>.a. >..
echo .$foo[1,-8].
0:An empty slice with a negative length
>..
echo .$foo[0]. echo .$foo[0].
0:Array indexing 0:Treat 0 like 1
>.a. >.a.
echo .$foo[1]. echo .$foo[0,0].
0:Array indexing 0:Treat 0,0 like 1,1.
>.a.
echo .$foo[0,1].
0:Another weird way to access the first element
>.a. >.a.
echo .$foo[3]. echo .$foo[3].
0:Array indexing 0:An inner element
>.c. >.c.
echo .$foo[0,1].
0:Array indexing
>.a.
echo .$foo[2,2]. echo .$foo[2,2].
0:Array indexing 0:Another inner element
>.b. >.b.
echo .$foo[1,0]. echo .$foo[2,-4].
0:Array indexing 0:A slice with a negative length
>.. >.b c d.
echo .$foo[-4,5]. echo .$foo[-4,5].
0:Array indexing 0:A slice with a negative start
>.d e. >.d e.
echo .$foo[-6,-2]. echo .$foo[-6,-2].
0:Array indexing 0:A slice with both items negative
>.b c d e f. >.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.