From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: Zsh Hackers' List <zsh-workers@zsh.org>
Subject: Re: PATCH: disabling pattern groups
Date: Thu, 24 Oct 2013 19:21:39 +0100 [thread overview]
Message-ID: <20131024192139.1fe3f39a@pws-pc.ntlworld.com> (raw)
In-Reply-To: <20131023220526.36682868@pws-pc.ntlworld.com>
On Wed, 23 Oct 2013 22:05:26 +0100
Peter Stephenson <p.w.stephenson@ntlworld.com> wrote:
> Next, I'll start constructing some tests.
This covers the basics.
diff --git a/Test/D02glob.ztst b/Test/D02glob.ztst
index 0aea261..d6ab733 100644
--- a/Test/D02glob.ztst
+++ b/Test/D02glob.ztst
@@ -433,3 +433,61 @@
print glob.tmp/dir5/N<->(N)
0:Numeric glob is not usurped by process substitution.
>glob.tmp/dir5/N123
+
+ tpd() {
+ [[ $1 = $~2 ]]
+ print -r "$1, $2: $?"
+ }
+ test_pattern_disables() {
+ emulate -L zsh
+ tpd 'forthcoming' 'f*g'
+ disable -p '*'
+ tpd 'forthcoming' 'f*g'
+ tpd 'f*g' 'f*g'
+ tpd '[frog]' '[frog]'
+ tpd '[frog]' '\[[f]rog\]'
+ disable -p '['
+ tpd '[frog]' '[frog]'
+ tpd '[frog]' '\[[f]rog\]'
+ setopt extendedglob
+ tpd 'foo' '^bar'
+ disable -p '^'
+ tpd 'foo' '^bar'
+ tpd '^bar' '^bar'
+ tpd 'rumble' '(rumble|bluster)'
+ tpd '(thunder)' '(thunder)'
+ disable -p '('
+ tpd 'rumble' '(rumble|bluster)'
+ tpd '(thunder)' '(thunder)'
+ setopt kshglob
+ tpd 'scramble' '@(panic|frenzy|scramble)'
+ tpd '@(scrimf)' '@(scrimf)'
+ disable -p '@('
+ tpd 'scramble' '@(panic|frenzy|scramble)'
+ tpd '@(scrimf)' '@(scrimf)'
+ disable -p
+ }
+ test_pattern_disables
+ print Nothing should be disabled.
+ disable -p
+0:disable -p
+>forthcoming, f*g: 0
+>forthcoming, f*g: 1
+>f*g, f*g: 0
+>[frog], [frog]: 1
+>[frog], \[[f]rog\]: 0
+>[frog], [frog]: 0
+>[frog], \[[f]rog\]: 1
+>foo, ^bar: 0
+>foo, ^bar: 1
+>^bar, ^bar: 0
+>rumble, (rumble|bluster): 0
+>(thunder), (thunder): 1
+>rumble, (rumble|bluster): 1
+>(thunder), (thunder): 0
+>scramble, @(panic|frenzy|scramble): 0
+>@(scrimf), @(scrimf): 1
+>scramble, @(panic|frenzy|scramble): 1
+>@(scrimf), @(scrimf): 0
+>'(' '*' '[' '^' '@('
+>Nothing should be disabled.
--
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
prev parent reply other threads:[~2013-10-24 18:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-23 21:05 Peter Stephenson
2013-10-24 18:21 ` Peter Stephenson [this message]
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=20131024192139.1fe3f39a@pws-pc.ntlworld.com \
--to=p.w.stephenson@ntlworld.com \
--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).