spec/async/io/stream_spec.rb in async-io-1.12.1 vs spec/async/io/stream_spec.rb in async-io-1.12.2

- old
+ new

@@ -48,16 +48,27 @@ expect(stream).to be_eof end end describe '#read_until' do + include_context Async::RSpec::Memory + it "can read a line" do io.write("hello\nworld\n") io.seek(0) expect(stream.read_until("\n")).to be == 'hello' expect(stream.read_until("\n")).to be == 'world' expect(stream.read_until("\n")).to be_nil + end + + it "minimises allocations" do + io.write("hello\nworld\n") + io.seek(0) + + expect do + stream.read_until("\n") + end.to limit_allocations(String => 3) end end describe '#flush' do it "should not call write if write buffer is empty" do