summaryrefslogtreecommitdiff
path: root/spec/ruby/library/stringio/shared/write.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/stringio/shared/write.rb')
-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