diff options
author | Peter Stephenson <pws@zsh.org> | 2017-09-27 09:41:50 +0100 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2017-09-27 09:41:50 +0100 |
commit | 6230e82d44da25773437c5438c83a5d5fe275420 (patch) | |
tree | 123f2cfd0c646b662208cd231e5431b97024feb9 /Test/D04parameter.ztst | |
parent | 03af5fdbeed0930b5f1d3715ee1080fb993ed145 (diff) | |
download | zsh-6230e82d44da25773437c5438c83a5d5fe275420.tar.gz zsh-6230e82d44da25773437c5438c83a5d5fe275420.tar.xz zsh-6230e82d44da25773437c5438c83a5d5fe275420.zip |
41764 (test tweaked): allow [key]+=value when modifying arrays
Diffstat (limited to 'Test/D04parameter.ztst')
-rw-r--r-- | Test/D04parameter.ztst | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst index abac8f7a0..d6ed6487b 100644 --- a/Test/D04parameter.ztst +++ b/Test/D04parameter.ztst @@ -2302,3 +2302,37 @@ F:behavior, see http://austingroupbugs.net/view.php?id=888 >KVA2two >KVA3three >* + + local -a keyvalarray + keyvalarray=(1 2 3) + keyvalarray+=([1]+=a [2]=b) + print $keyvalarray +0:Append to element(s) of array +>1a b 3 + + local -A keyvalhash + keyvalhash=([a]=a [b]=b [c]=c) + keyvalhash+=([a]+=yee [b]=ee) + local key val + for key in "${(ok)keyvalhash[@]}"; do + val=${keyvalhash[$key]} + print -r -- $key $val + done +0:Append to element(s) of associative array +>a ayee +>b ee +>c c + + local -a keyvalarray + keyvalarray=([1]=who [2]=anyway [1]+=is [1]+=that [1]+=mysterious [1]+=man) + print -rl -- "${keyvalarray[@]}" +0:Append to element of associative array on creation +>whoisthatmysteriousman +>anyway + + local -A keyvalhash + keyvalhash=([one]=hows [one]+=your [one]+=father [one]+=today) + print -rl -- ${(kv)keyvalhash} +0:Append to element of associative array on creation +>one +>howsyourfathertoday |