zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: bug in read builtin and Re: PATCH: extra loop tests
Date: Wed, 26 Mar 2003 18:24:39 +0100	[thread overview]
Message-ID: <2861.1048699479@finches.logica.co.uk> (raw)
In-Reply-To: <20706.1048688201@csr.com>

Peter wrote:
> Tests for the enhanced `for' syntax as well as `select' which is now

I've just added a few tests too. In adding tests for read (to cover the
new read -d), I found that read -t 1 -p causes a seg fault:

#0  0x080bb323 in read_poll (fd=-1, readchar=0xbffff0fc, polltty=0, 
    microseconds=1000000) at utils.c:1398
#1  0x0805eec7 in bin_read (name=0x40020248 "read", args=0xbffff170, 
    ops=0xbffff1b0, func=0) at builtin.c:4215
#2  0x08052545 in execbuiltin (args=0x40020210, bn=0x80cbab4) at builtin.c:440

> Extra tests gratefully received, as Felix reminded us, particularly for
> interactive stuff (zle, completion) which I will not be attempting
> myself.

I've not attempted anything for interactive stuff either I'm afraid.
I've also not done anything for \u or the math locale problem because it
would be dependant on the local environment and the test system sets
LANG=C anyway.

> When we finally get the multiple defined limits problem fixed, I will
> produce a test version of 4.1.1.  If tests continue to trickle in, so
> much the better.

Also one of 17797 or 17820 should be committed before a release. I don't
have access to cygwin so can't test 17820.

There have been enough changes to warrant a 4.0.7 before too long.
Any suggestions on stuff which can be merged back from 4.1?

Oliver

Index: Test/.distfiles
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/.distfiles,v
retrieving revision 1.14
diff -u -r1.14 .distfiles
--- Test/.distfiles	17 Dec 2001 17:17:38 -0000	1.14
+++ Test/.distfiles	26 Mar 2003 17:05:03 -0000
@@ -8,6 +8,6 @@
 A04redirect.ztst     D01prompt.ztst       V02zregexparse.ztst
 A05execution.ztst    D02glob.ztst         Y01completion.ztst
 D06subscript.ztst    V01zmodload.ztst     E01options.ztst
-B02typeset.ztst      B03print.ztst        A06assign.ztst
+B02typeset.ztst      B03print.ztst        A06assign.ztst       B04read.ztst
 README
 '
Index: Test/B03print.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/B03print.ztst,v
retrieving revision 1.5
diff -u -r1.5 B03print.ztst
--- Test/B03print.ztst	27 Aug 2002 21:11:44 -0000	1.5
+++ Test/B03print.ztst	26 Mar 2003 17:05:03 -0000
@@ -199,3 +199,7 @@
 0:argument specified for precision only
 >2
 >000
+
+ printf -- '%s\n' str
+0:initial `--' ignored to satisfy POSIX
+>str
Index: Test/B04read.ztst
===================================================================
RCS file: Test/B04read.ztst
diff -N Test/B04read.ztst
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Test/B04read.ztst	26 Mar 2003 17:05:03 -0000
@@ -0,0 +1,65 @@
+# Tests for the read builtin
+
+# Tested elsewhere:
+#  reading from a coprocess  A01grammar, A04redirect
+
+# Not tested:
+#  -c/-l/-n (options for compctl functions)
+#  -q/-s (needs a tty)
+
+%test
+
+ read <<<'hello world'
+ print $REPLY
+0:basic read command
+>hello world
+
+ read -A <<<'hello world'
+ print $reply[2]
+0:array read
+>world
+
+ read -k3 -u0 <<<foo:bar
+ print $REPLY
+0:read specified number of chars
+>foo
+
+ read -d: <<<foo:bar
+ print $REPLY
+0:read up to delimiter
+>foo
+
+ print foo:bar|IFS=: read -A
+ print $reply
+0:use different, IFS separator to array
+>foo bar
+
+ print -z hello world; read -z
+ print $REPLY
+0:read from editor buffer stack
+>hello world
+
+ unset REPLY
+ read -E <<<hello
+ print $REPLY
+0:read with echoing and assigning
+>hello
+>hello
+
+ unset REPLY
+ read -e <<<hello
+ print $REPLY
+0:read with echoing but assigning disabled
+>hello
+>
+
+ read -e -t <<<hello
+0:read with test first
+>hello
+
+ SECONDS=0
+ read -e -t 5 <<<hello
+ print $SECONDS
+0:read with timeout (no waiting should occur)
+>hello
+>0
Index: Test/C01arith.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/C01arith.ztst,v
retrieving revision 1.5
diff -u -r1.5 C01arith.ztst
--- Test/C01arith.ztst	23 Jan 2002 16:28:17 -0000	1.5
+++ Test/C01arith.ztst	26 Mar 2003 17:05:03 -0000
@@ -98,3 +98,7 @@
   print $x
 0:assigning to scalar which contains non-math string
 >32
+
+  print $(( ))
+0:empty math parse e.g. $(( )) acts like a zero
+>0
Index: Test/D02glob.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/D02glob.ztst,v
retrieving revision 1.1
diff -u -r1.1 D02glob.ztst
--- Test/D02glob.ztst	2 Apr 2001 12:33:33 -0000	1.1
+++ Test/D02glob.ztst	26 Mar 2003 17:05:03 -0000
@@ -16,7 +16,7 @@
     setopt nonullglob nomatch
     print glob.tmp/**/*~(.)#
   }
-
+  
 %test
 
   globtest globtests
@@ -265,3 +265,28 @@
 0:exclusions regression test
 >
 >glob.tmp/a glob.tmp/b glob.tmp/c glob.tmp/dir1 glob.tmp/dir1/a glob.tmp/dir1/b glob.tmp/dir1/c glob.tmp/dir2 glob.tmp/dir2/a glob.tmp/dir2/b glob.tmp/dir2/c
+
+ print glob.tmp/*(/)
+0:Just directories
+>glob.tmp/dir1 glob.tmp/dir2
+
+ print glob.tmp/*(.)
+0:Just files
+>glob.tmp/a glob.tmp/b glob.tmp/c
+
+ print glob.tmp/*(.e^'reply=( glob.tmp/*/${REPLY:t} )'^:t)
+0:Globbing used recursively (inside e glob qualifier)
+>a a b b c c
+
+ print glob.tmp/**/(:h) 
+0:Head modifier
+>. glob.tmp glob.tmp
+
+ print glob.tmp(:r)
+0:Remove extension modifier
+>glob
+
+ print glob.tmp/*(:s/./_/)
+0:Substitute modifier
+>glob_tmp/a glob_tmp/b glob_tmp/c glob_tmp/dir1 glob_tmp/dir2
+


  reply	other threads:[~2003-03-26 17:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-26 14:16 Peter Stephenson
2003-03-26 17:24 ` Oliver Kiddle [this message]
2003-03-26 17:52   ` bug in read builtin and " Peter Stephenson

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=2861.1048699479@finches.logica.co.uk \
    --to=okiddle@yahoo.co.uk \
    --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).