about summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2014-09-29 21:02:59 +0100
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2014-09-29 21:02:59 +0100
commitcf6b0f5663e798c8d4303697115230ac4469baca (patch)
tree6d91ba3556177799897a307b3c17ca7c286f7d0e /Test
parent4a529201b8524bb3b149a5e7702bbaf8787617f2 (diff)
downloadzsh-cf6b0f5663e798c8d4303697115230ac4469baca.tar.gz
zsh-cf6b0f5663e798c8d4303697115230ac4469baca.tar.xz
zsh-cf6b0f5663e798c8d4303697115230ac4469baca.zip
33285: apply function definition redirections at execution
Diffstat (limited to 'Test')
-rw-r--r--Test/A04redirect.ztst38
1 files changed, 37 insertions, 1 deletions
diff --git a/Test/A04redirect.ztst b/Test/A04redirect.ztst
index 7ad02db3b..436ae59cd 100644
--- a/Test/A04redirect.ztst
+++ b/Test/A04redirect.ztst
@@ -54,7 +54,7 @@
 0:Here-documents stripping tabs
 >barbar
 
-  cat <<-$'$HERE '`$(THERE) `'$((AND)) '"\EVERYWHERE"
+  cat <<-$'$HERE '`$(THERE) `'$((AND)) '"\EVERYWHERE" #
 # tabs again.  sorry about the max miller.
 	Here's a funny thing.  Here is a funny thing.
 	I went home last night.  There's a funny thing.
@@ -455,3 +455,39 @@
 
   [</dev/null ]
 1:check behaviour with square brackets
+
+  print any old rubbish >input1
+  () {
+    local var
+    read var
+    print I just read $var
+  } <input1 >output1
+  print Nothing output yet
+  cat output1
+0:anonymous function redirections are applied immediately
+>Nothing output yet
+>I just read any old rubbish
+
+  redirfn() {
+    local var
+    read var
+    print I want to tell you about $var
+    print Also, this might be an error >&2
+  } <input2 >output2 2>&1
+  print something I heard on the radio >input2
+  redirfn
+  print No output until after this
+  cat output2
+0:redirections with normal function definition
+>No output until after this
+>I want to tell you about something I heard on the radio
+>Also, this might be an error
+
+  which redirfn
+0:text output of function with redirections
+>redirfn () {
+>	local var
+>	read var
+>	print I want to tell you about $var
+>	print Also, this might be an error >&2
+>} < input2 > output2 2>&1