Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH (not final)] (take three?) unset "array[$anything]"



On Wed, Jun 2, 2021 at 7:42 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> Also, if you know of good test cases, please try them / send them along.

I've now tried all the hash keys from the test harness in
 https://unix.stackexchange.com/questions/626393/in-zsh-how-do-i-unset-an-arbitrary-associative-array-element/626529#626529
It found a few additional misfires when using the (b) flag with the
stripquote variation, but both literal and stripquote worked in the
respectively expected ways for all those cases plus some others I had
already tried.

Furthermore, both of them do approximately as well with the $MATCH
pattern from workers/43269 as does the current variation -- the
original shell unsets 281 out of 291 keys, the literal variation 280,
and the stripquote variation 284.  The keys not unset using that
pattern are different in each of the three cases, except that they all
fail to unset key='\`' ... several of the failures with the literal
variation have multiple backslashes, though not always consecutive,
and it does fail with key=']' and key='\' which could be important.

So, we're probably in pretty safe territory with either choice but in
terms of backwards compatibility the stripquote version is slightly
ahead.




Messages sorted by: Reverse Date, Date, Thread, Author