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

Re: FW: Zsh 4.3.12 failure on OpenBSD

On 1 June 2011 13:11, Peter Stephenson <pws@xxxxxxx> wrote:
> On Wed, 01 Jun 2011 11:33:22 +0100, Mikael Magnusson <mikachu@xxxxxxxxx>
> wrote:
>> Okay, so in a latin1 locale, \M-a is á which is printable, so it isn't
>> converted back to \M-a by (V). I also noticed that in one of the
>> tests, the input has "^X" but not the c flag, but does use V, so the
>> test can't tell if it was converted or not, because it'll always come
>> out as ascii "^X". I guess there's not really much point in testing
>> \M-a, since I already test \C-x and it's handled by the same code. The
>> test is just for calling the function that does that properly, not
>> that that function actually works ;). I hope I can at least rely on
>> \C-x not being printable anywhere? Or is it okay to include a literal
>> ^X in the expected test output? I'm not sure how else I can test that
>> ^X is parsed properly.
> Ideally we want to output stuff as a stream of octets.  I'm not
> sure there's an easy way of doing that with parameters alone.
> You can use $(( #foo )), looping over octets in the string.
> If you want to test non-ASCII characters you can use
> the multibyte test file, which ensures the locale is
> using UTF-8.

I realized that maybe the easiest way is to just test that [[
${(g:oe:):-'\C-\130'} == ${(g:c:):-'^X'} ]]; echo $? outputs 0.

diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index 6379c8c..050340d 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -300,23 +300,16 @@

   print -r ${(g:o:)foo}
-  foo='\u65\0123'
+  foo='\u65\0123^X\C-x'
   print -r ${(g::)foo}
-  foo='\u65^X'
-  print -r ${(V)${(g:c:)foo}}
-  foo='\u65\C-x\M-a'
-  print -r ${(V)${(g:e:)foo}}
-  foo='\u65\123\C-x'
-  print -r ${(V)${(g:eo:)foo}}
-  foo=('\u65' '\0123' '^X\M-a')
-  print -r ${(V)${(g:e:)foo}}
+  foo='^X'
+  bar='\C-\130'
+  [[ ${(g:c:)foo} == ${(g:oe:)bar} ]]
+  echo $?
->e S ^X\M-a

   foo='I'\''m nearly out of my mind with tedium'

Mikael Magnusson

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