mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-25 17:20:25 +02:00
users/15662: array slice assignment with one index positive and one negative.
This commit is contained in:
parent
d3ec328926
commit
bc1a12f91e
3 changed files with 33 additions and 4 deletions
|
|
@ -104,7 +104,29 @@
|
|||
0:Replacement off start doesn't leave gaps. Hope this is right.
|
||||
>43 1 2 3 4 5
|
||||
|
||||
# TODO: mixed indices [-num,num] and [num,-num]
|
||||
array=(1 2 3 4 5)
|
||||
array[1,-1]=(42 43)
|
||||
print $array
|
||||
array[-3,3]=(1 2 3 4 5)
|
||||
print $array
|
||||
0:Replacement of entire array, mixed indices
|
||||
>42 43
|
||||
>1 2 3 4 5
|
||||
|
||||
array=(1 2 3 4 5)
|
||||
array[-7,7]=(42 43)
|
||||
print $array
|
||||
0:Replacement of more than entire array, mixed indices
|
||||
>42 43
|
||||
|
||||
array=(1 2 3 4 5)
|
||||
array[3,-2]=(42 43 44)
|
||||
print $array
|
||||
array[-3,5]=(100 99)
|
||||
print $array
|
||||
0:Replacement of slice in middle, mixed indices
|
||||
>1 2 42 43 44 5
|
||||
>1 2 42 100 99 5
|
||||
|
||||
# tests of var+=scalar
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue