zsh-workers
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <psprint@zdharma.org>
To: zsh-workers@zsh.org
Subject: Re: Tests for substitutions
Date: Wed, 29 Mar 2017 09:18:14 +0200	[thread overview]
Message-ID: <etPan.58db5fb6.79e2a9e3.17199@MacMini.local> (raw)
In-Reply-To: <etPan.58db5c72.2eb141f2.17199@MacMini.local>

PS. I was grepping for match\\\[, but this doesn't equal substitutions, isn't even directly related. Grepping "zipp" reveals that this is tested. So, I just submit a new test that stresses multiple flags, and tests code execution with (#b)

On 29 marca 2017 at 09:04:18, Sebastian Gniazdowski (psprint@zdharma.org) wrote:
> Hello,
> I'm little anxious about future of ZUI, despite that it works from Zsh-4.3.17 to 5.3.1-dev.0,  
> because it uses very much power that Zsh has. In e.g. Python it wouldn't be possible to  
> do what follows:
>  
> - create hyperlink text with 3 backend variables, that is turned into Unicode text – with  
> 1 substitution
>  
> The substitution uses P,Q,A,s,r,m flags. I've created a test for it. Hyperlink is created  
> as follows:
>  
> my_width=6
> my_index=1
> my_options=Option1
> hyperlink=$'\034'"MYID"$'\034'"DATA1"$'\034'"DATA2"$'\034'"DATA3"$'\034'"my_width"$'\034'"my_index"$'\034'"my_options"$'\02'  
>  
> The substitution is:
>  
> array=( "${array[@]//(#b).../${(mr:${(P)${(Q)match[1]}}:: :)${(As:;:)${(P)${(Q)match[3]}}}[${(P)${(Q)match[2]}}]}}"  
> )
>  
> I've skipped the part that matches the three embedded parameters. So, all is unicode-display-width  
> padded and trimmed to ${(P)match[1]}, my_options ${(P)match[3]} is splitted on ';',  
> (A) makes (s) return array also for no-split-case, and this is indexed with ${(P)match[2]}  
> – with my_index value.
>  
> Could this test be added? Because besides this, there are also no tests for substitutions.  
> The test stresses P,Q,A,s,r,m and code execution with (#b), but I would also add some  
> few tests for zipping, :|, :*, etc. Not that I aim at saturating substitution topic, just  
> would ship few tests.
>  
> However, while the code works in shell, testing framework outputs:
> (eval):6: unrecognized modifier `T'
> (eval):6: bad math expression: empty string
>  
> the "bad math …" usually comes from wrong backend parameter name in hyperlink, but the  
> code works fine in shell. Could someone look into testing framework? It apparently does  
> something with test's text.
>  
> --
> Sebastian Gniazdowski
> psprint /at/ zdharma.org

--
Sebastian Gniazdowski
psprint /at/ zdharma.org


       reply	other threads:[~2017-03-29  7:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <etPan.58db5c72.2eb141f2.17199@MacMini.local>
2017-03-29  7:18 ` Sebastian Gniazdowski [this message]
     [not found] <CGME20170329072608epcas5p17078c2cac7402d90b44e23acb7d52946@epcas5p1.samsung.com>
2017-03-29  7:04 ` Sebastian Gniazdowski
2017-03-29  9:01   ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=etPan.58db5fb6.79e2a9e3.17199@MacMini.local \
    --to=psprint@zdharma.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).