diff options
author | Peter Stephenson <pws@zsh.org> | 2015-06-24 10:14:39 +0100 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2015-06-24 10:14:39 +0100 |
commit | 4a63170c2ccc383fe7b9efb15944179e48ab4f91 (patch) | |
tree | f9e4cac49f1b45512cfe949888f839abd739e4b9 | |
parent | 7529c2a1585e099c15ec7ab11b14bfad2e02135f (diff) | |
download | zsh-typeset-array.tar.gz zsh-typeset-array.tar.xz zsh-typeset-array.zip |
Test typeset preserves types of existing variables when already local typeset-array
-rw-r--r-- | Test/B02typeset.ztst | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/Test/B02typeset.ztst b/Test/B02typeset.ztst index 48d16533a..4afb18962 100644 --- a/Test/B02typeset.ztst +++ b/Test/B02typeset.ztst @@ -595,7 +595,7 @@ enable -r typeset disable typeset print reserved - eval $fn;fn + eval $fn; fn ) 0:reserved word and builtin interfaces >reserved @@ -607,3 +607,47 @@ >reserved >one word=two > + + fn() { + emulate -L zsh + setopt typeset_silent + local k + typeset -A hash=(k1 v1 k2 v2) + typeset foo=word array=(more than one word) + for k in ${(ko)hash}; do + print $k $hash[$k] + done + print -l $foo $array + typeset -A hash + typeset foo array + for k in ${(ko)hash}; do + print $k $hash[$k] + done + print -l $foo $array + typeset hash=(k3 v3 k4 v4) array=(odd number here) + for k in ${(ko)hash}; do + print $k $hash[$k] + done + print -l $array + } + fn +0:typeset preserves existing variable types +>k1 v1 +>k2 v2 +>word +>more +>than +>one +>word +>k1 v1 +>k2 v2 +>word +>more +>than +>one +>word +>k3 v3 +>k4 v4 +>odd +>number +>here |