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

Re: PATCH: expanding parameters like echo/print builtins

On 11 May 2011 18:21, Peter Stephenson <Peter.Stephenson@xxxxxxx> wrote:
> On Wed, 11 May 2011 15:02:51 +0200
> Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>>       * The (@) flag; interacts obscurely with qt and isarr.
>>       * This is one of the things that decides whether multsub
>>       * will produce an array, but in an extremely indirect fashion.
>> @@ -1932,6 +1936,36 @@ paramsubst(LinkList l, LinkNode n, char **str,
>> int qt, int ssub) presc++;
>>                   break;
>> +             case 'z':
> This might want to be 'g'.

Indeed, I noticed this line had spaces instead of tabs, so while
editing the patch file I copied the z line from the context and added
a +, taking care to change the z to a g as I did so, but somehow
didn't actually. So if this made you worry that I hadn't tested the
patch, fear not :). Speaking of testing, should I add tests for this
too? The c and e flags will have tendencies to output unprintable
characters, can I write them in the expected test output somehow? Ie,
it is probably not a good idea to write
when testing that feature, since it'll break in the same way in both
places. It is probably not likely that c specifically would break and
everything else work, so I would personally be happy with just testing
g:: and maybe g:o: too, since that's easy enough. In fact...

--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -298,6 +298,14 @@

+  foo='\u65\123'
+  print -r ${(g:o:)foo}
+  foo='\u65\0123'
+  print -r ${(g::)foo}
   foo='I'\''m nearly out of my mind with tedium'
   print ${(P)bar}

Mikael Magnusson

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