zsh-workers
 help / color / mirror / code / Atom feed
* Actually do test what I claimed to test
@ 2015-11-26 17:26 Bart Schaefer
  2015-11-26 18:04 ` Peter Stephenson
  2015-11-26 20:13 ` Danek Duvall
  0 siblings, 2 replies; 8+ messages in thread
From: Bart Schaefer @ 2015-11-26 17:26 UTC (permalink / raw)
  To: zsh-workers

The test I added in 37208 wasn't doing what I intended.

Anyone see a portability problem with my use of "sed" here?


diff --git a/Test/V10private.ztst b/Test/V10private.ztst
index f877455..d5bee5e 100644
--- a/Test/V10private.ztst
+++ b/Test/V10private.ztst
@@ -6,12 +6,17 @@
    ZTST_unimplemented="can't load the zsh/param/private module for testing"
  fi
 
+ # Do not use .tmp here, ztst.zsh will remove it too soon (see %cleanup)
+ mkdir private.TMP
+ sed '/^%prep/a \
+  zmodload zsh/param/private' < $ZTST_srcdir/B02typeset.ztst > private.TMP/B02
+
 %test
 
  (zmodload -u zsh/param/private && zmodload zsh/param/private)
 0:unload and reload the module without crashing
 
- $ZTST_exe +Z -f $ZTST_srcdir/ztst.zsh $ZTST_srcdir/B02typeset.ztst
+ ZTST_verbose=0 $ZTST_exe +Z -f $ZTST_srcdir/ztst.zsh private.TMP/B02
 0:typeset still works with zsh/param/private module loaded
 *>*
 *>*
@@ -270,3 +275,7 @@ F:note "typeset" rather than "private" in output from outer
 
  () { private -h SECONDS }
 0:private parameter may hide a special parameter
+
+%clean
+
+  rm -r private.TMP


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Actually do test what I claimed to test
  2015-11-26 17:26 Actually do test what I claimed to test Bart Schaefer
@ 2015-11-26 18:04 ` Peter Stephenson
  2015-11-26 20:13 ` Danek Duvall
  1 sibling, 0 replies; 8+ messages in thread
From: Peter Stephenson @ 2015-11-26 18:04 UTC (permalink / raw)
  To: zsh-workers

On Thu, 26 Nov 2015 09:26:36 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> The test I added in 37208 wasn't doing what I intended.
> 
> Anyone see a portability problem with my use of "sed" here?

It's an unreadable squiggle, so it must be correct sed syntax.

I suspect we've got worse than that in the build system.

pws


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Actually do test what I claimed to test
  2015-11-26 17:26 Actually do test what I claimed to test Bart Schaefer
  2015-11-26 18:04 ` Peter Stephenson
@ 2015-11-26 20:13 ` Danek Duvall
  2015-11-27  8:09   ` Jun T.
  1 sibling, 1 reply; 8+ messages in thread
From: Danek Duvall @ 2015-11-26 20:13 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

On Thu, Nov 26, 2015 at 09:26:36AM -0800, Bart Schaefer wrote:

> The test I added in 37208 wasn't doing what I intended.
> 
> Anyone see a portability problem with my use of "sed" here?

Doesn't work on Solaris unless you scrap the space between the "a" and the
backslash.  Then it seems to do the trick, and with GNU sed, too.

Danek

> 
> diff --git a/Test/V10private.ztst b/Test/V10private.ztst
> index f877455..d5bee5e 100644
> --- a/Test/V10private.ztst
> +++ b/Test/V10private.ztst
> @@ -6,12 +6,17 @@
>     ZTST_unimplemented="can't load the zsh/param/private module for testing"
>   fi
>  
> + # Do not use .tmp here, ztst.zsh will remove it too soon (see %cleanup)
> + mkdir private.TMP
> + sed '/^%prep/a \
> +  zmodload zsh/param/private' < $ZTST_srcdir/B02typeset.ztst > private.TMP/B02
> +
>  %test
>  
>   (zmodload -u zsh/param/private && zmodload zsh/param/private)
>  0:unload and reload the module without crashing
>  
> - $ZTST_exe +Z -f $ZTST_srcdir/ztst.zsh $ZTST_srcdir/B02typeset.ztst
> + ZTST_verbose=0 $ZTST_exe +Z -f $ZTST_srcdir/ztst.zsh private.TMP/B02
>  0:typeset still works with zsh/param/private module loaded
>  *>*
>  *>*
> @@ -270,3 +275,7 @@ F:note "typeset" rather than "private" in output from outer
>  
>   () { private -h SECONDS }
>  0:private parameter may hide a special parameter
> +
> +%clean
> +
> +  rm -r private.TMP


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Actually do test what I claimed to test
  2015-11-26 20:13 ` Danek Duvall
@ 2015-11-27  8:09   ` Jun T.
  2015-11-27 10:32     ` Bart Schaefer
  0 siblings, 1 reply; 8+ messages in thread
From: Jun T. @ 2015-11-27  8:09 UTC (permalink / raw)
  To: zsh-workers


On 2015/11/27, at 5:13, Danek Duvall <duvall@comfychair.org> wrote:
> 
> Doesn't work on Solaris unless you scrap the space between the "a" and the
> backslash.  Then it seems to do the trick, and with GNU sed, too.

It still fails on Mac OS X and freebsd (maybe also on other BSD's).
sed on these OS's strips the leading white spaces before the 'text'
in the following command:

/pat/a\
  text

On the zsh command line, I can use (both on Linux and OS X)

% sed '/pat/a\
\  text' < in > out

but if I modify V10private.ztst as

 sed '/^%prep/a\
\ zmodload zsh/param/private' < ... > ...

the I get

(eval):3: unmatched '

Is there any way to properly quote the \ (at the beginning of line) in ztst
file? If not, using awk may be a possible alternative.

diff --git a/Test/V10private.ztst b/Test/V10private.ztst
index bb456f2..5efc453 100644
--- a/Test/V10private.ztst
+++ b/Test/V10private.ztst
@@ -8,8 +8,8 @@
 
  # Do not use .tmp here, ztst.zsh will remove it too soon (see %cleanup)
  mkdir private.TMP
- sed '/^%prep/a\
-  zmodload zsh/param/private' < $ZTST_srcdir/B02typeset.ztst > private.TMP/B02
+ awk '1; /%prep/ {print " zmodload zsh/param/private"}' \
+   $ZTST_srcdir/B02typeset.ztst > private.TMP/B02
 
 %test
 




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Actually do test what I claimed to test
  2015-11-27  8:09   ` Jun T.
@ 2015-11-27 10:32     ` Bart Schaefer
  2015-11-27 10:57       ` Jun T.
  2015-11-27 11:32       ` Peter Stephenson
  0 siblings, 2 replies; 8+ messages in thread
From: Bart Schaefer @ 2015-11-27 10:32 UTC (permalink / raw)
  To: zsh-workers

On Nov 27,  5:09pm, Jun T. wrote:
}
} It still fails on Mac OS X and freebsd (maybe also on other BSD's).
} sed on these OS's strips the leading white spaces before the 'text'
[...]
} Is there any way to properly quote the \ (at the beginning of line) in ztst
} file? If not, using awk may be a possible alternative.

The number of leading spaces doesn't matter, so just don't put the
backslash at the beginning of the line, put a space on each side of it:

diff --git a/Test/V10private.ztst b/Test/V10private.ztst
index bb456f2..cb2075c 100644
--- a/Test/V10private.ztst
+++ b/Test/V10private.ztst
@@ -8,8 +8,8 @@
 
  # Do not use .tmp here, ztst.zsh will remove it too soon (see %cleanup)
  mkdir private.TMP
- sed '/^%prep/a\
-  zmodload zsh/param/private' < $ZTST_srcdir/B02typeset.ztst > private.TMP/B02
+ sed -e '/^%prep/a\
+ \ zmodload zsh/param/private' < $ZTST_srcdir/B02typeset.ztst > private.TMP/B02
 
 %test


Does that cover it?


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Actually do test what I claimed to test
  2015-11-27 10:32     ` Bart Schaefer
@ 2015-11-27 10:57       ` Jun T.
  2015-11-27 11:32       ` Peter Stephenson
  1 sibling, 0 replies; 8+ messages in thread
From: Jun T. @ 2015-11-27 10:57 UTC (permalink / raw)
  To: zsh-workers


On 2015/11/27, at 19:32, Bart Schaefer <schaefer@brasslantern.com> wrote:
> 
> put a space on each side of it:

> Does that cover it?

Yes, it works.

# I've been thinking I tried it already but it seems I did something different.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Actually do test what I claimed to test
  2015-11-27 10:32     ` Bart Schaefer
  2015-11-27 10:57       ` Jun T.
@ 2015-11-27 11:32       ` Peter Stephenson
  2015-11-27 19:10         ` Bart Schaefer
  1 sibling, 1 reply; 8+ messages in thread
From: Peter Stephenson @ 2015-11-27 11:32 UTC (permalink / raw)
  To: zsh-workers

On Fri, 27 Nov 2015 02:32:51 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> + sed -e '/^%prep/a\
> + \ zmodload zsh/param/private' < $ZTST_srcdir/B02typeset.ztst > private.TMP/B02
>
> Does that cover it?

If you want to be srue, stick a placeholder line in the file and simply
replace that.

pws


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Actually do test what I claimed to test
  2015-11-27 11:32       ` Peter Stephenson
@ 2015-11-27 19:10         ` Bart Schaefer
  0 siblings, 0 replies; 8+ messages in thread
From: Bart Schaefer @ 2015-11-27 19:10 UTC (permalink / raw)
  To: zsh-workers

On Nov 27, 11:32am, Peter Stephenson wrote:
} Subject: Re: Actually do test what I claimed to test
}
} If you want to be srue, stick a placeholder line in the file and simply
} replace that.

Yeah, I was trying to avoid changing B02typeset, but this really is
the best way.


diff --git a/Test/B02typeset.ztst b/Test/B02typeset.ztst
index 1b8caee..954ae32 100644
--- a/Test/B02typeset.ztst
+++ b/Test/B02typeset.ztst
@@ -21,6 +21,7 @@
 #  Assorted illegal flag combinations
 
 %prep
+  # test_zsh_param_private
 
   mkdir typeset.tmp && cd typeset.tmp
 
diff --git a/Test/V10private.ztst b/Test/V10private.ztst
index bb456f2..317e869 100644
--- a/Test/V10private.ztst
+++ b/Test/V10private.ztst
@@ -8,8 +8,7 @@
 
  # Do not use .tmp here, ztst.zsh will remove it too soon (see %cleanup)
  mkdir private.TMP
- sed '/^%prep/a\
-  zmodload zsh/param/private' < $ZTST_srcdir/B02typeset.ztst > private.TMP/B02
+ sed -e 's,# test_zsh_param_private,zmodload zsh/param/private,' < $ZTST_srcdir/B02typeset.ztst > private.TMP/B02
 
 %test
 


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-11-27 19:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-26 17:26 Actually do test what I claimed to test Bart Schaefer
2015-11-26 18:04 ` Peter Stephenson
2015-11-26 20:13 ` Danek Duvall
2015-11-27  8:09   ` Jun T.
2015-11-27 10:32     ` Bart Schaefer
2015-11-27 10:57       ` Jun T.
2015-11-27 11:32       ` Peter Stephenson
2015-11-27 19:10         ` Bart Schaefer

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).