Skip to content

Commit cf7de9b

Browse files
committed
Add specs for StringIO position after reading multi-byte chars.
1 parent 2d0ae5e commit cf7de9b

File tree

1 file changed

+6
-0
lines changed
  • spec/ruby/library/stringio/shared

1 file changed

+6
-0
lines changed

spec/ruby/library/stringio/shared/read.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@
8989
@io.send(@method)
9090
@io.pos.should eql(7)
9191
end
92+
93+
it "correctly update the current position in bytes when multi-byte characters are used" do
94+
@io.print("example\u03A3") # Overwrite the original string with 8 characters containing 9 bytes.
95+
@io.send(@method)
96+
@io.pos.should eql(9)
97+
end
9298
end
9399

94100
describe :stringio_read_nil, shared: true do

0 commit comments

Comments
 (0)