From 79a1b20743e3bbe5c4b48a0f16b8b07408e2eda6 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Wed, 21 Aug 2024 12:37:48 +1200 Subject: [PATCH] More tests. --- test/protocol/http/body/stream.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/protocol/http/body/stream.rb b/test/protocol/http/body/stream.rb index 60956f5..3b117ee 100644 --- a/test/protocol/http/body/stream.rb +++ b/test/protocol/http/body/stream.rb @@ -147,6 +147,16 @@ expect(stream.readpartial(20)).to be == "World" expect{stream.readpartial(20)}.to raise_exception(EOFError) end + + it "can read partial input with buffer" do + buffer = String.new + expect(stream.readpartial(20, buffer)).to be == "Hello" + expect(buffer).to be == "Hello" + expect(stream.readpartial(20, buffer)).to be == "World" + expect(buffer).to be == "World" + expect{stream.readpartial(20, buffer)}.to raise_exception(EOFError) + expect(buffer).to be == "" + end end with '#read_until' do