summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--Test/.distfiles2
-rw-r--r--Test/B03print.ztst4
-rw-r--r--Test/B04read.ztst65
-rw-r--r--Test/C01arith.ztst4
-rw-r--r--Test/D02glob.ztst25
6 files changed, 103 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 710a89704..fa8c98257 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/Test/.distfiles b/Test/.distfiles
index 4a4904085..310744772 100644
--- a/Test/.distfiles
+++ b/Test/.distfiles
@@ -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
'
diff --git a/Test/B03print.ztst b/Test/B03print.ztst
index 4022bc646..f2e12978c 100644
--- a/Test/B03print.ztst
+++ b/Test/B03print.ztst
@@ -199,3 +199,7 @@
0:argument specified for precision only
>2
>000
+
+ printf -- '%s\n' str
+0:initial `--' ignored to satisfy POSIX
+>str
diff --git a/Test/B04read.ztst b/Test/B04read.ztst
new file mode 100644
index 000000000..45a3486af
--- /dev/null
+++ b/Test/B04read.ztst
@@ -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
diff --git a/Test/C01arith.ztst b/Test/C01arith.ztst
index 0492a20aa..8558d66a8 100644
--- a/Test/C01arith.ztst
+++ b/Test/C01arith.ztst
@@ -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
diff --git a/Test/D02glob.ztst b/Test/D02glob.ztst
index 3a64b8c22..1c8b7acc6 100644
--- a/Test/D02glob.ztst
+++ b/Test/D02glob.ztst
@@ -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
+