zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: More comments in ztst files
@ 2001-03-24 23:57 Bart Schaefer
  2001-03-25  0:19 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Bart Schaefer @ 2001-03-24 23:57 UTC (permalink / raw)
  To: zsh-workers

General remark -- in several of the ztst files, there are comments about
not being able to test various interactive operations, such as `select'
loops (always read from terminal) or `[[ -t 0 ]]'.  We should lump these
into a later test and use the zpty module the way we do for completion.
I haven't actually done this.

In 04redirect.ztst:

# Following two tests have to be separated since in
#   print bar >foo >bar && print "$(<foo) $(<bar)"
# the multios aren't flushed until after the substitutions take
# place.  This can't be right.

Multios are of course handled by forking a process that, in effect, performs
"tee" from the output of the command to the multiple output descriptors.  To
fix the abovementioned bug, we'd have to synchronize the start of the next
command with the end of the "tee" process.

# Currently, <out{1,2} doesn't work: this is a bug.

Hmm, seems to work for me.  Anybody know when it began to, or why whoever
wrote this comment thinks it doesn't?  (No change for this in the patch.)

In 10prompt.ztst:

# 'mydir=$PWD; hash -d mydir; print -P %~' doesn't seem to abbreviate
# to ~mydir in a non-interactive shell.  Is this correct?

This apparently is correct.  From utils.c:adduserdir():

    /* We don't maintain a hash table in non-interactive shells. */
    if (!interact)
	return;

However, `hash -d mydir=$mydir' bypasses adduserdir() and adds the entry,
so the comment in utils.c is not quite accurate either.

In 13 parameter.ztst:

  # WHY DO I NEED TO QUOTE ${array} HERE?????
  print IF{"${array}",THEN}ELSE

Because without the quotes it expands to (IF{once) (bitten) (twice) etc.,
whereas with the quotes (IF{once bitten twice shy,THEN}ELSE).

  # it doesn't *say* these are case-insensitive without i...
  # I think this is a bug.

Where "these" are ${(o)...} and ${(O)...}.  The manual does in fact say
that (i) means sort case-insensitively with (o).  By implication, sorting
should be case-sensitive without it, right?  The results seem to be in
case-sensitive order, so I'm not sure what was up with this comment.

Peter must have really been pining for William Dalrymple at this point.

  # ${bar} -> $bar  turns this into $$, which doesn't strike me as correct.

Where "this" is ${(...)${bar}}.  We've long since decided that's correct;
in fact, zsh now prints "bad substitution" for ${$bar}.

That's it.  The other two hunks remove a comment from 01grammar that I
meant to remove in my last patch for it, and add to ztst.zsh a line to
print when the tests begin as well as when they end, which is helpful to
my sanity.

Index: Test/01grammar.ztst
===================================================================
--- Test/01grammar.ztst	2001/03/24 22:19:21	1.5
+++ Test/01grammar.ztst	2001/03/24 22:19:51
@@ -289,8 +289,6 @@
 >Hip hip hooray
 >Hip hip hooray
 
-# Why doesn't this one work here?  It works from the command line
-# or with zsh -fc.
   case bravo {
     (alpha) print schmalpha
 	    ;;
Index: Test/10prompt.ztst
===================================================================
--- Test/10prompt.ztst	2000/02/11 06:59:21	1.2
+++ Test/10prompt.ztst	2001/03/24 23:16:25
@@ -6,10 +6,9 @@
 
 %test
 
-# 'mydir=$PWD; hash -d mydir; print -P %~' doesn't seem to abbreviate
-# to ~mydir in a non-interactive shell.  Is this correct?
-
+  hash -d mydir=$mydir
   print -P '  %%%):  %)
+  %%~:  %~
   %%d:  %d
   %%1/: %1/
   %%h:  %h
@@ -23,6 +22,7 @@
   '
 0q:Basic prompt escapes as shown.
 >  %):  )
+>  %~:  ~mydir
 >  %d:  $mydir
 >  %1/: ${mydir:t}
 >  %h:  0
Index: Test/13parameter.ztst
===================================================================
--- Test/13parameter.ztst	2000/05/03 10:44:46	1.2
+++ Test/13parameter.ztst	2001/03/24 23:38:47
@@ -157,7 +157,7 @@
 >IFonce bitten twice shyTHEN
 >IFonceTHEN IFbittenTHEN IFtwiceTHEN IFshyTHEN
 
-  # WHY DO I NEED TO QUOTE ${array} HERE?????
+  # Quote ${array} here because {...,...} doesn't like unquoted spaces.
   print IF{"${array}",THEN}ELSE
   print IF{${^array},THEN}ELSE
 0:combined ${^...} and {...,...}
@@ -221,8 +221,6 @@
 0:${(P)...}
 >I'm nearly out of my mind with tedium
 
-  # it doesn't *say* these are case-insensitive without i...
-  # I think this is a bug.
   foo=(I could be watching that programme I recorded)
   print ${(o)foo}
   print ${(oi)foo}
@@ -466,7 +464,7 @@
 >b* e*
 >boringfile evenmoreboringfile
 
-  # ${bar} -> $bar  turns this into $$, which doesn't strike me as correct.
+  # ${bar} -> $bar  here would yield "bad substitution".
   bar=confinement
   print ${(el.20..X.)${bar}}
 0:Rule 11: Padding
Index: Test/ztst.zsh
===================================================================
--- Test/ztst.zsh	2000/06/07 16:56:19	1.11
+++ Test/ztst.zsh	2001/03/23 18:31:05
@@ -336,6 +336,8 @@
 typeset -A ZTST_sects
 ZTST_sects=(prep 0 test 0 clean 0)
 
+print "$ZTST_testname: starting."
+
 # Now go through all the different sections until the end.
 while ZTST_getsect; do
   case $ZTST_cursect in

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


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

* Re: PATCH: More comments in ztst files
  2001-03-24 23:57 PATCH: More comments in ztst files Bart Schaefer
@ 2001-03-25  0:19 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2001-03-25  0:19 UTC (permalink / raw)
  To: Zsh hackers list

Bart wrote:
>   # it doesn't *say* these are case-insensitive without i...
>   # I think this is a bug.
> 
> Where "these" are ${(o)...} and ${(O)...}.  The manual does in fact say
> that (i) means sort case-insensitively with (o).  By implication, sorting
> should be case-sensitive without it, right?  The results seem to be in
> case-sensitive order, so I'm not sure what was up with this comment.

There was some argy bargy about the effect of locales, which caused some
confusion about this: in some locales (even English language ones) the
sorting was automatically case-insensitive.  We now reset LC_ALL to C in
ztst.zsh.  But this doesn't seem to be enough.

- I I be could programme recorded that watching
  be could I I programme recorded that watching
! watching that recorded programme could be I I
  watching that recorded programme I I could be
--- 1,4 ----
  be could I I programme recorded that watching
! be could I I programme recorded that watching
! watching that recorded programme I I could be
  watching that recorded programme I I could be

This is because Chmouel and company have done the job more thoroughly this
time (Mandrake 7.2):

exported LC_COLLATE=en_GB             # form orderly bus queues
exported LC_CTYPE=en_GB
exported LC_MESSAGES=en_GB            # don't say `have a nice day'
exported LC_MONETARY=en_GB            # devalue everything in sight
exported LC_NUMERIC=en_GB
exported LC_TIME=en_GB

The patch below fixes LC_COLLATE, too.

> Peter must have really been pining for William Dalrymple at this point.

Oh, dear.  I don't think I've ever really read what I wrote before.

Index: Test/ztst.zsh
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/ztst.zsh,v
retrieving revision 1.5
diff -u -r1.5 ztst.zsh
--- Test/ztst.zsh	2000/06/07 09:02:24	1.5
+++ Test/ztst.zsh	2001/03/25 00:16:09
@@ -25,6 +25,7 @@
 # Ensure the locale does not screw up sorting.  Don't supply a locale
 # unless there's one set, to minimise problems.
 [[ -n $LC_ALL ]] && LC_ALL=C
+[[ -n $LC_COLLATE ]] && LC_COLLATE=C
 [[ -n $LANG ]] && LANG=C
 
 # Set the module load path to correspond to this build of zsh.

-- 
Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
Work: pws@csr.com
Web: http://www.pwstephenson.fsnet.co.uk


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

end of thread, other threads:[~2001-03-25  0:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-24 23:57 PATCH: More comments in ztst files Bart Schaefer
2001-03-25  0:19 ` 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).