1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-11 13:01:28 +02:00

18389: new for and select tests

This commit is contained in:
Peter Stephenson 2003-03-26 14:55:42 +00:00
parent 839bdc3942
commit 913d526600
2 changed files with 39 additions and 12 deletions

View file

@ -1,3 +1,8 @@
2003-03-26 Peter Stephenson <pws@csr.com>
* 18389: Test/A01grammar.ztst: `select' test, test for
multi-parameter `for' syntax.
2003-03-25 Wayne Davison <wayned@users.sourceforge.net> 2003-03-25 Wayne Davison <wayned@users.sourceforge.net>
* 18383: Src/utils.c: Fixed zjoin() when it returns an empty * 18383: Src/utils.c: Fixed zjoin() when it returns an empty

View file

@ -136,6 +136,29 @@
>1 >1
>2 >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 name=0
while (( name < 3 )); do while (( name < 3 )); do
print $name print $name
@ -208,18 +231,17 @@
>2 >2
>3 >3
## This doesn't work, because zsh tries to read from the terminal ## Select now reads from stdin if the shell is not interactive.
## even in a non-interactive shell. The manual implies it always reads ## Its own output goes to stderr.
## from stdin, even in an interactive shell. PS3="input> "
# PS3="input> " select name in one two three; do
# select name in one two three; do print $name
# print $name done
# done 0:`select' loop
#0:`select' loop <2
#<2 ?1) one 2) two 3) three
#>1) one 2) two 3) three ?input> input>
#>input> >two
#>two
function name1 name2 () { print This is $0; } function name1 name2 () { print This is $0; }
name2 name2