Skip to content

Commit 42e038e

Browse files
hsbtclaude
andcommitted
Hand FakeReadPartialIO binary chunks
replace copies the encoding along with the content, so UTF-8 literals turned @rbuf into UTF-8 for the whole test. A real IO leaves the binary buffer it was given alone, and readuntil mixes byte counts with String#index offsets that only agree while the buffer is binary. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 42ad702 commit 42e038e

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

test/net/protocol/test_protocol.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ def test_write0_timeout_multi2
130130

131131
class FakeReadPartialIO
132132
def initialize(chunks)
133-
@chunks = chunks.map(&:dup)
133+
# Binary, like the bytes a real IO hands back, and duped because
134+
# rbuf_fill clears whatever read_nonblock returns.
135+
@chunks = chunks.map { |chunk| chunk.b }
134136
end
135137

136138
def read_nonblock(size, buf = nil, exception: false)

0 commit comments

Comments
 (0)