diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | Test/A01grammar.ztst | 46 |
2 files changed, 39 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog index d22d150df..d1dac4bd8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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> * 18383: Src/utils.c: Fixed zjoin() when it returns an empty 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 |