about summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2003-03-26 14:55:42 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2003-03-26 14:55:42 +0000
commit913d5266003fb75a9acd2f19fdd8e5a1ccbf9221 (patch)
treee5fc2e0cd87b2eeb080a77cd90eb5aafa204d8cf /Test
parent839bdc3942df44bf8237351025e90f340ce17607 (diff)
downloadzsh-913d5266003fb75a9acd2f19fdd8e5a1ccbf9221.tar.gz
zsh-913d5266003fb75a9acd2f19fdd8e5a1ccbf9221.tar.xz
zsh-913d5266003fb75a9acd2f19fdd8e5a1ccbf9221.zip
18389: new for and select tests
Diffstat (limited to 'Test')
-rw-r--r--Test/A01grammar.ztst46
1 files changed, 34 insertions, 12 deletions
diff --git a/Test/A01grammar.ztst b/Test/A01grammar.ztst
index 026539307..918f77c0a 100644
--- a/Test/A01grammar.ztst
+++ b/Test/A01grammar.ztst
@@ -136,6 +136,29 @@
 >1
 >2
 
+  for keyvar valvar in key1 val1 key2 val2; do
+     print key=$keyvar val=$valvar
+  done
+0:enhanced `for' syntax with two loop variables
+>key=key1 val=val1
+>key=key2 val=val2
+
+  for keyvar valvar stuffvar in keyA valA stuffA keyB valB stuffB; do
+     print key=$keyvar val=$valvar stuff=$stuffvar
+  done
+0:enhanced `for' syntax with three loop variables
+>key=keyA val=valA stuff=stuffA
+>key=keyB val=valB stuff=stuffB
+
+  for in in in in in stop; do
+    print in=$in
+  done
+0:compatibility of enhanced `for' syntax with standard syntax
+>in=in
+>in=in
+>in=in
+>in=stop
+
   name=0
   while (( name < 3 )); do
     print $name
@@ -208,18 +231,17 @@
 >2
 >3
 
-## This doesn't work, because zsh tries to read from the terminal
-## even in a non-interactive shell.  The manual implies it always reads
-## from stdin, even in an interactive shell.
-#  PS3="input> "
-#  select name in one two three; do
-#    print $name
-#  done
-#0:`select' loop
-#<2
-#>1) one     2) two     3) three   
-#>input> 
-#>two
+## Select now reads from stdin if the shell is not interactive.
+## Its own output goes to stderr.
+  PS3="input> "
+  select name in one two three; do
+    print $name
+  done
+0:`select' loop
+<2
+?1) one     2) two     3) three   
+?input> input> 
+>two
 
   function name1 name2 () { print This is $0; }
   name2