1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-06-08 00:06:04 +02:00

18391: add tests for read builtin a few glob qualifiers, 17678 and 18015

This commit is contained in:
Oliver Kiddle 2003-03-26 17:33:04 +00:00
parent a9293199ec
commit 244f2a14fc
6 changed files with 103 additions and 1 deletions

View File

@ -1,5 +1,9 @@
2003-03-26 Oliver Kiddle <opk@zsh.org>
* 18391: Test/.distfiles, Test/B03print.ztst, Test/B04read.ztst,
Test/C01arith.ztst, Test/D02glob.ztst: add tests for read builtin
a few glob qualifiers, 17678 and 18015
* 18390: Completion/Unix/Command/_prcs,
Completion/Unix/Command/_xmlsoft: tidy up _prcs and update
_xmlsoft for latest version of xsltproc

View File

@ -8,6 +8,6 @@ A03quoting.ztst C04funcdef.ztst Makefile.in ztst.zsh
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
'

View File

@ -199,3 +199,7 @@
0:argument specified for precision only
>2
>000
printf -- '%s\n' str
0:initial `--' ignored to satisfy POSIX
>str

65
Test/B04read.ztst Normal file
View File

@ -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

View File

@ -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

View File

@ -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