From: Wayne Davison <wayned@users.sourceforge.net>
To: Peter Stephenson <pws@csr.com>
Cc: Zsh hackers list <zsh-workers@sunsite.dk>
Subject: Re: PATCH: fixing ${1+"$@"} when word-splitting
Date: Mon, 13 Feb 2006 12:11:21 -0800 [thread overview]
Message-ID: <20060213201121.GG6952@dot.blorf.net> (raw)
In-Reply-To: <EXCHANGE03ljU5R7iUP0000c9cd@exchange03.csr.com>
[-- Attachment #1: Type: text/plain, Size: 297 bytes --]
On Mon, Feb 13, 2006 at 07:33:43PM +0000, Peter Stephenson wrote:
> Here's an add-on test that handles a lot of the possibilities. I think
> the results are all correct.
Looks good to me. I also added a couple tests. The combination of both
our changes relative to CVS is attached.
..wayne..
[-- Attachment #2: d04.patch --]
[-- Type: text/plain, Size: 2300 bytes --]
--- Test/D04parameter.ztst 11 Oct 2005 16:48:06 -0000 1.13
+++ Test/D04parameter.ztst 13 Feb 2006 20:04:16 -0000
@@ -547,20 +547,128 @@
>shell
>again
- set If "this test fails" maybe "we have finally fixed" the shell
+ local sure_that='sure that' varieties_of='varieties of' one=1 two=2
+ set Make $sure_that "this test keeps" on 'preserving all' "$varieties_of" quoted whitespace
print -l ${=1+"$@"}
-0:Regression test of unfixed ${=1+"$@"} bug
->If
->this
->test
->fails
->maybe
->we
->have
->finally
->fixed
->the
->shell
+ print -l ${=1+Make $sure_that "this test keeps" on 'preserving all' "$varieties_of" quoted whitespace}
+ print -l ${=1+$one $two}
+0:Regression test of ${=1+"$@"} bug and some related expansions
+>Make
+>sure that
+>this test keeps
+>on
+>preserving all
+>varieties of
+>quoted
+>whitespace
+>Make
+>sure
+>that
+>this test keeps
+>on
+>preserving all
+>varieties of
+>quoted
+>whitespace
+>1
+>2
+
+ splitfn() {
+ local IFS=.-
+ local foo=1-2.3-4
+ #
+ print "Called with argument '$1'"
+ print "No quotes"
+ print -l ${=1:-1-2.3-4} ${=1:-$foo}
+ print "With quotes on default argument only"
+ print -l ${=1:-"1-2.3-4"} ${=1:-"$foo"}
+ }
+ print 'Using "="'
+ splitfn
+ splitfn 5.6-7.8
+ #
+ splitfn() {
+ emulate -L zsh
+ setopt shwordsplit
+ local IFS=.-
+ local foo=1-2.3-4
+ #
+ print "Called with argument '$1'"
+ print "No quotes"
+ print -l ${1:-1-2.3-4} ${1:-$foo}
+ print "With quotes on default argument only"
+ print -l ${1:-"1-2.3-4"} ${1:-"$foo"}
+ }
+ print Using shwordsplit
+ splitfn
+ splitfn 5.6-7.8
+0:Test of nested word splitting with and without quotes
+>Using "="
+>Called with argument ''
+>No quotes
+>1
+>2
+>3
+>4
+>1
+>2
+>3
+>4
+>With quotes on default argument only
+>1-2.3-4
+>1-2.3-4
+>Called with argument '5.6-7.8'
+>No quotes
+>5
+>6
+>7
+>8
+>5
+>6
+>7
+>8
+>With quotes on default argument only
+>5
+>6
+>7
+>8
+>5
+>6
+>7
+>8
+>Using shwordsplit
+>Called with argument ''
+>No quotes
+>1
+>2
+>3
+>4
+>1
+>2
+>3
+>4
+>With quotes on default argument only
+>1-2.3-4
+>1-2.3-4
+>Called with argument '5.6-7.8'
+>No quotes
+>5
+>6
+>7
+>8
+>5
+>6
+>7
+>8
+>With quotes on default argument only
+>5
+>6
+>7
+>8
+>5
+>6
+>7
+>8
unset SHLVL
(( SHLVL++ ))
next prev parent reply other threads:[~2006-02-13 20:11 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-09 23:32 Libtool/zsh quoting problem David Gómez
2006-02-10 8:46 ` DervishD
2006-02-10 9:48 ` David Gómez
2006-02-10 11:34 ` DervishD
2006-02-10 12:56 ` David Gómez
2006-02-10 14:25 ` DervishD
2006-02-10 18:27 ` David Gómez
2006-02-10 19:31 ` DervishD
2006-02-11 9:36 ` [SOLVED] Libtool/zsh quoting problem: a zsh... bug? DervishD
2006-02-11 10:21 ` Andrey Borzenkov
2006-02-11 11:06 ` DervishD
2006-02-11 11:33 ` David Gómez
2006-02-11 12:06 ` DervishD
2006-02-11 12:28 ` Andrey Borzenkov
2006-02-11 18:07 ` DervishD
2006-02-11 12:21 ` DervishD
2006-02-11 18:14 ` Wayne Davison
2006-02-11 18:22 ` DervishD
2006-02-11 18:58 ` Wayne Davison
2006-02-11 19:42 ` Bart Schaefer
2006-02-12 4:50 ` Wayne Davison
2006-02-12 20:28 ` Peter Stephenson
2006-02-13 10:56 ` Peter Stephenson
2006-02-12 7:46 ` Andrey Borzenkov
2006-02-12 7:54 ` Andrey Borzenkov
2006-02-12 20:26 ` Peter Stephenson
2006-02-13 10:53 ` PATCH: fixing ${1+"$@"} when word-splitting Wayne Davison
2006-02-13 11:34 ` Peter Stephenson
2006-02-13 17:43 ` Wayne Davison
2006-02-13 18:08 ` Peter Stephenson
2006-02-13 19:00 ` Wayne Davison
2006-02-13 19:33 ` Wayne Davison
2006-02-13 19:33 ` Peter Stephenson
2006-02-13 20:11 ` Wayne Davison [this message]
2006-02-13 19:48 ` Wayne Davison
2006-02-13 11:40 ` DervishD
2006-02-14 7:14 ` Wayne Davison
2006-02-15 10:31 ` Wayne Davison
2006-02-15 11:35 ` Wayne Davison
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=20060213201121.GG6952@dot.blorf.net \
--to=wayned@users.sourceforge.net \
--cc=pws@csr.com \
--cc=zsh-workers@sunsite.dk \
/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).