From bbf54ec334fe2edd7669a944d88d17efde49a412 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Thu, 5 Jan 2023 19:05:29 +0100 Subject: Update to ruby/spec@9d69b95 --- spec/ruby/library/stringio/shared/write.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'spec/ruby/library/stringio/shared') diff --git a/spec/ruby/library/stringio/shared/write.rb b/spec/ruby/library/stringio/shared/write.rb index c5a0f8f513..d9c21028e0 100644 --- a/spec/ruby/library/stringio/shared/write.rb +++ b/spec/ruby/library/stringio/shared/write.rb @@ -66,6 +66,28 @@ describe :stringio_write_string, shared: true do @io.tainted?.should be_false end end + + it "handles writing non-ASCII UTF-8 after seek" do + @io.binmode + @io << "\x80" + @io.pos = 0 + @io << "\x81" + @io.string.should == "\x812345".b + end + + it "handles writing with position < buffer size" do + @io.pos = 2 + @io.write "abc" + @io.string.should == "12abc" + + @io.pos = 2 + @io.write "de" + @io.string.should == "12dec" + + @io.pos = 2 + @io.write "fghi" + @io.string.should == "12fghi" + end end describe :stringio_write_not_writable, shared: true do -- cgit v1.2.3