summaryrefslogtreecommitdiff
path: root/spec/ruby/library/stringio/shared
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2023-01-05 19:05:29 +0100
committerBenoit Daloze <eregontp@gmail.com>2023-01-05 19:05:29 +0100
commitbbf54ec334fe2edd7669a944d88d17efde49a412 (patch)
tree2941c7b711319b295aa3664b6a2b984e70a523b7 /spec/ruby/library/stringio/shared
parentcd5e6cc0ea48353c88d921b885b552dc76da255c (diff)
Update to ruby/spec@9d69b95
Diffstat (limited to 'spec/ruby/library/stringio/shared')
-rw-r--r--spec/ruby/library/stringio/shared/write.rb22
1 files changed, 22 insertions, 0 deletions
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