summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2003-03-26 17:33:04 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2003-03-26 17:33:04 +0000
commit244f2a14fc2c0b9a57d782a290d17bc1a4299600 (patch)
treeb0292bfde2229c0f95d5bb319290974adba0e9f1 /Test
parenta9293199ec03d0a941504b06b3f4f07d97626fef (diff)
downloadzsh-244f2a14fc2c0b9a57d782a290d17bc1a4299600.tar.gz
zsh-244f2a14fc2c0b9a57d782a290d17bc1a4299600.tar.xz
zsh-244f2a14fc2c0b9a57d782a290d17bc1a4299600.zip
18391: add tests for read builtin a few glob qualifiers, 17678 and 18015
Diffstat (limited to 'Test')
-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
5 files changed, 99 insertions, 1 deletions
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
+