Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: More comments in ztst files



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   



Messages sorted by: Reverse Date, Date, Thread, Author