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

Re: Tests for substitutions



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@xxxxxxxxxxx) 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



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