Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
bug in read builtin and Re: PATCH: extra loop tests
- X-seq: zsh-workers 18391
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx (Zsh hackers list)
- Subject: bug in read builtin and Re: PATCH: extra loop tests
- Date: Wed, 26 Mar 2003 18:24:39 +0100
- In-reply-to: <20706.1048688201@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20706.1048688201@xxxxxxx>
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
+
Messages sorted by:
Reverse Date,
Date,
Thread,
Author