mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-02 22:11:54 +02:00
Fix handling of metafied characters in trailing whitespace on read
This commit is contained in:
parent
5b947bf671
commit
6114ee2fe3
3 changed files with 2055 additions and 842 deletions
|
@ -1,3 +1,11 @@
|
|||
2005-04-25 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 21184: Test/B04read.ztst: test for foregoing fix.
|
||||
|
||||
* users/8752: Src/builtin.c: stripping IFS characters after
|
||||
reading a line in the read builtin wasn't sensitive to metafied
|
||||
characters.
|
||||
|
||||
2005-04-24 Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
|
||||
|
||||
* 21170: Src/glob.c, Src/pattern.c, Src/complist.c: optimise
|
||||
|
|
2811
Src/builtin.c
2811
Src/builtin.c
File diff suppressed because it is too large
Load diff
78
Test/B04read.ztst
Normal file
78
Test/B04read.ztst
Normal file
|
@ -0,0 +1,78 @@
|
|||
# Tests for the read builtin
|
||||
|
||||
# Tested elsewhere:
|
||||
# reading from a coprocess A01grammar, A04redirect
|
||||
|
||||
# Not tested:
|
||||
# -c/-l/-n (options for compctl functions)
|
||||
# -q/-s (needs a tty)
|
||||
|
||||
%test
|
||||
|
||||
read <<<'hello world'
|
||||
print $REPLY
|
||||
0:basic read command
|
||||
>hello world
|
||||
|
||||
read -A <<<'hello world'
|
||||
print $reply[2]
|
||||
0:array read
|
||||
>world
|
||||
|
||||
read -k3 -u0 <<<foo:bar
|
||||
print $REPLY
|
||||
0:read specified number of chars
|
||||
>foo
|
||||
|
||||
read -d: <<<foo:bar
|
||||
print $REPLY
|
||||
0:read up to delimiter
|
||||
>foo
|
||||
|
||||
print foo:bar|IFS=: read -A
|
||||
print $reply
|
||||
0:use different, IFS separator to array
|
||||
>foo bar
|
||||
|
||||
print -z hello world; read -z
|
||||
print $REPLY
|
||||
0:read from editor buffer stack
|
||||
>hello world
|
||||
|
||||
unset REPLY
|
||||
read -E <<<hello
|
||||
print $REPLY
|
||||
0:read with echoing and assigning
|
||||
>hello
|
||||
>hello
|
||||
|
||||
unset REPLY
|
||||
read -e <<<hello
|
||||
print $REPLY
|
||||
0:read with echoing but assigning disabled
|
||||
>hello
|
||||
>
|
||||
|
||||
read -e -t <<<hello
|
||||
0:read with test first
|
||||
>hello
|
||||
|
||||
SECONDS=0
|
||||
read -e -t 5 <<<hello
|
||||
print $SECONDS
|
||||
0:read with timeout (no waiting should occur)
|
||||
>hello
|
||||
>0
|
||||
|
||||
print -n 'Testing the\0null hypothesis\0' |
|
||||
while read -d $'\0' line; do print $line; done
|
||||
0:read with null delimiter
|
||||
>Testing the
|
||||
>null hypothesis
|
||||
|
||||
# Note that trailing NULLs are not stripped even if they are in
|
||||
# $IFS; only whitespace characters contained in $IFS are stripped.
|
||||
print -n $'Aaargh, I hate nulls.\0\0\0' | read line
|
||||
print ${#line}
|
||||
0:read with trailing metafied characters
|
||||
>24
|
Loading…
Reference in a new issue