1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-23 16:40:24 +02:00

32246: option "shift -p" pops arguments from end of array

This commit is contained in:
Peter Stephenson 2014-01-11 19:31:29 +00:00
parent 8fd6d5766c
commit ed44ddad22
5 changed files with 69 additions and 7 deletions

View file

@ -15,6 +15,7 @@ B04read.ztst
B05eval.ztst
B06fc.ztst
B07emulate.ztst
B08shift.ztst
C01arith.ztst
C02cond.ztst
C03traps.ztst

View file

@ -0,0 +1,33 @@
# Test the shift builtin.
%test
set -- one two three four five six seven eight nine ten
shift
print $*
shift 2
print $*
shift -p 3
print $*
shift -p
print $*
0:shifting positional parameters
>two three four five six seven eight nine ten
>four five six seven eight nine ten
>four five six seven
>four five six
array=(yan tan tether mether pip azer sezar akker conter dick)
shift 2 array
print $array
shift array
print $array
shift -p 3 array
print $array
shift -p array
print $array
0:shifting array
>tether mether pip azer sezar akker conter dick
>mether pip azer sezar akker conter dick
>mether pip azer sezar
>mether pip azer