mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
5a5a6a6968
read_in_chunks does not clear the intermediate string 'str' between iterations, so every chunk has every other chunk prepended to it. A secondary issue is that it calls str2wcstring() on an intermediate chunk, which may split multi-byte sequences. This needs to be deferred to the end. Test added. Fixes #3756
60 lines
561 B
Text
60 lines
561 B
Text
2
|
|
2
|
|
1
|
|
[one
|
|
two]
|
|
1
|
|
[one
|
|
two]
|
|
1
|
|
[one
|
|
two
|
|
]
|
|
|
|
1 'hello' 1 'there'
|
|
1 'hello there'
|
|
1 ''
|
|
1 '' 1 ''
|
|
1 'test' 1 '' 1 ''
|
|
1 'foo' 1 'bar' 1 ' baz'
|
|
0 a
|
|
|
|
1 'hello'
|
|
1 'h' 1 'ello'
|
|
1 'h' 1 'e' 1 'llo'
|
|
1 ''
|
|
1 't' 1 ''
|
|
1 't' 1 '' 1 ''
|
|
1 ' ' 1 't'
|
|
|
|
2 'hello' 'there'
|
|
1 'hello'
|
|
6 'this' 'is' 'a' 'bunch' 'of' 'words'
|
|
3 'one' 'two' 'three'
|
|
0
|
|
|
|
5 'h' 'e' 'l' 'l' 'o'
|
|
1 'h'
|
|
0
|
|
|
|
# read -n tests
|
|
tes
|
|
test
|
|
test
|
|
tes
|
|
tin
|
|
t
|
|
|
|
# read -z tests
|
|
testing
|
|
test ing
|
|
newline
|
|
|
|
1 'test' 1 'ing'
|
|
1 'test' 1 ''
|
|
1 'foo' 1 'bar'
|
|
2 'foo' 'bar'
|
|
2 'baz' 'quux'
|
|
|
|
# chunked read tests
|
|
Chunked reads test pass
|