mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-04 10:41:11 +02:00
18418: fix select test and add parameter tests
This commit is contained in:
parent
259de0b742
commit
a78bff4398
3 changed files with 30 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
2003-04-01 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 18418: Test/A01grammar.ztst, Test/D04parameter.ztst:
|
||||
fix select test from 18389 and add tests for $MATCH and $match
|
||||
and related parameters.
|
||||
|
||||
2003-03-31 Felix Rosencrantz <f_rosencrantz@yahoo.com>
|
||||
|
||||
* unposted: Functions/TCP/.distfiles: Removed zgprintf, file was
|
||||
|
|
|
@ -233,10 +233,11 @@
|
|||
|
||||
## Select now reads from stdin if the shell is not interactive.
|
||||
## Its own output goes to stderr.
|
||||
(COLUMNS=80
|
||||
PS3="input> "
|
||||
select name in one two three; do
|
||||
print $name
|
||||
done
|
||||
done)
|
||||
0:`select' loop
|
||||
<2
|
||||
?1) one 2) two 3) three
|
||||
|
|
|
@ -555,3 +555,25 @@
|
|||
>/here:/there
|
||||
>0
|
||||
>/elsewhere /somewhere
|
||||
|
||||
string='look for a match in here'
|
||||
if [[ ${string%%(#b)(match)*} = "look for a " ]]; then
|
||||
print $match[1] $mbegin[1] $mend[1] $string[$mbegin[1],$mend[1]]
|
||||
print $#match $#mbegin $#mend
|
||||
else
|
||||
print That didn\'t work.
|
||||
fi
|
||||
0:Parameters associated with backreferences
|
||||
>match 12 16 match
|
||||
>1 1 1
|
||||
|
||||
string='and look for a MATCH in here'
|
||||
if [[ ${(S)string%%(#m)M*H} = "and look for a in here" ]]; then
|
||||
print $MATCH $MBEGIN $MEND $string[$MBEGIN,$MEND]
|
||||
print $#MATCH
|
||||
else
|
||||
print Oh, dear. Back to the drawing board.
|
||||
fi
|
||||
0:Parameters associated with (#m) flag
|
||||
>MATCH 16 20 MATCH
|
||||
>5
|
||||
|
|
Loading…
Reference in a new issue