Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: ${a[(i)pattern]} if a=()
- X-seq: zsh-workers 24719
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxxxxx>
- Subject: Re: ${a[(i)pattern]} if a=()
- Date: Sun, 16 Mar 2008 11:47:47 -0700
- In-reply-to: <080316105924.ZM843@xxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20080316144038.GA4910@xxxxxxxxxxxxxxx> <080316102021.ZM28339@xxxxxxxxxxxxxxxxxxxxxx> <080316105924.ZM843@xxxxxxxxxxxxxxxxxxxxxx>
On Mar 16, 10:59am, Bart Schaefer wrote:
}
} The patch is trivial and all tests still pass.
Here's a test for that patch. Also fixes the previous test which
declared an empty array but then referenced an undefined variable.
Or at least I think what I changed is what the test really meant.
I won't commit this (or 24718) without some confirmation.
Index: Tests/D06subscript.ztst
===================================================================
--- Tests/D06subscript.ztst 26 Nov 2007 17:38:14 -0000 1.8
+++ Tests/D06subscript.ztst 16 Mar 2008 18:44:20 -0000
@@ -178,11 +178,15 @@
>lower
>upper
- typeset -a empty_array
- echo X${${l##*}[-1]}X
+ typeset -ga empty
+ echo X${${empty##*}[-1]}X
0:Negative index applied to substition result from empty array
>XX
+ print $empty[(i)] $empty[(I)]
+0:(i) returns 1 for empty array, (I) returns 0.
+>1 0
+
array=(one two three four)
print X$array[0]X
0:Element zero is empty if KSH_ZERO_SUBSCRIPT is off.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author