summaryrefslogtreecommitdiffstats
path: root/Test
diff options
context:
space:
mode:
authordana <dana@dana.is>2025-05-24 20:12:22 -0500
committerdana <dana@dana.is>2026-05-23 22:58:44 -0500
commitea8a4c1582adecc3938defc40f005db1c490063f (patch)
treec8340fe1be8c6ac3d43341684d261b1a3d8cc6c1 /Test
parent54591: fix new compiler warnings (diff)
downloadzsh-ea8a4c1582adecc3938defc40f005db1c490063f.tar
zsh-ea8a4c1582adecc3938defc40f005db1c490063f.tar.gz
zsh-ea8a4c1582adecc3938defc40f005db1c490063f.tar.bz2
zsh-ea8a4c1582adecc3938defc40f005db1c490063f.tar.lz
zsh-ea8a4c1582adecc3938defc40f005db1c490063f.tar.xz
zsh-ea8a4c1582adecc3938defc40f005db1c490063f.tar.zst
zsh-ea8a4c1582adecc3938defc40f005db1c490063f.zip
unposted: shift: improve count error message
message was inaccurate when an array was given by name
Diffstat (limited to 'Test')
-rw-r--r--Test/B08shift.ztst18
1 files changed, 18 insertions, 0 deletions
diff --git a/Test/B08shift.ztst b/Test/B08shift.ztst
index 0aa922673..a01128e4f 100644
--- a/Test/B08shift.ztst
+++ b/Test/B08shift.ztst
@@ -31,3 +31,21 @@
>mether pip azer sezar akker conter dick
>mether pip azer sezar
>mether pip azer
+
+ () { local -a arr=( a b c ); shift 9 arr }
+ () { local -a .tmp.arr=( a b c ); shift 9 .tmp.arr }
+ () { shift 9 argv } a b c
+ () { shift 9 } a b c
+1:shifting more elements than exist in array
+?(anon):shift: shift count must be <= ${#arr}
+?(anon):shift: shift count must be <= ${#.tmp.arr}
+?(anon):shift: shift count must be <= ${#argv}
+?(anon):shift: shift count must be <= $#
+
+ () { local -i i=3; shift 9 i; print -r - $i }
+ () { local s=x; shift 9 s; print -r - $s }
+ () { local -A h=( a b ); shift 9 h; print -r - ${(kv)h} }
+0:shifting non-array
+>3
+>x
+>a b