* Re: Tests for substitutions [not found] <etPan.58db5c72.2eb141f2.17199@MacMini.local> @ 2017-03-29 7:18 ` Sebastian Gniazdowski 0 siblings, 0 replies; 3+ messages in thread From: Sebastian Gniazdowski @ 2017-03-29 7:18 UTC (permalink / raw) To: zsh-workers 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <CGME20170329072608epcas5p17078c2cac7402d90b44e23acb7d52946@epcas5p1.samsung.com>]
* Tests for substitutions @ 2017-03-29 7:04 ` Sebastian Gniazdowski 2017-03-29 9:01 ` Peter Stephenson 0 siblings, 1 reply; 3+ messages in thread From: Sebastian Gniazdowski @ 2017-03-29 7:04 UTC (permalink / raw) To: zsh-workers [-- Attachment #1: Type: text/plain, Size: 1766 bytes --] 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 [-- Attachment #2: D10subst.ztst.txt --] [-- Type: text/plain, Size: 624 bytes --] # Tests for substitution %prep %test 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' array=( $hyperlink "Regular text" $hyperlink ) array=( "${array[@]//(#b)$'\034'[^$'\034']#$'\034'[^$'\034']#$'\034'[^$'\034']#$'\034'[^$'\034']#$'\034'([^$'\034']#)$'\034'([^$'\034']#)$'\034'([^$'\02']#)$'\02'/${(mr:${(P)${(Q)match[1]}}:: :)${(As:;:)${(P)${(Q)match[3]}}}[${(P)${(Q)match[2]}}]}}" ) print -rl -- "${array[@]}" 0:Test substitution that uses P,Q,A,s,r,m flags >Option >Regular text >Option ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Tests for substitutions 2017-03-29 7:04 ` Sebastian Gniazdowski @ 2017-03-29 9:01 ` Peter Stephenson 0 siblings, 0 replies; 3+ messages in thread From: Peter Stephenson @ 2017-03-29 9:01 UTC (permalink / raw) To: zsh-workers On Wed, 29 Mar 2017 09:04:18 +0200 Sebastian Gniazdowski <psprint@zdharma.org> wrote: > 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. I'm not sure what you mean by that, but I've appended to the end of the existing 2000 lines of tests for parameter substitutions and it seems to be working OK. Stress tests are certainly a useful addition. (m) ought to be tested in the multibyte file to avoid failures where there isn't a working multibyte environment but unless I'm missing something in this particular case the effect is trivial, which should certainly work everywhere. There are already tests for all the other flags, but in not in such dense combination. pws ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-03-29 9:02 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <etPan.58db5c72.2eb141f2.17199@MacMini.local> 2017-03-29 7:18 ` Tests for substitutions Sebastian Gniazdowski [not found] <CGME20170329072608epcas5p17078c2cac7402d90b44e23acb7d52946@epcas5p1.samsung.com> 2017-03-29 7:04 ` Sebastian Gniazdowski 2017-03-29 9:01 ` Peter Stephenson
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).