Skip to content

Commit 99c2b75

Browse files
herwinweregon
authored andcommitted
Add "reads after ungetc with multibyte characters in the buffer" spec to StringIO#readpartial
This one was missing in #1278, I got it to work with the `encoding: binary` directive. The StringIO code was fine, the spec was just incomplete.
1 parent 3ab8d84 commit 99c2b75

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

library/stringio/readpartial_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@
2424
@string.readpartial(3).should == ", l"
2525
end
2626

27+
it "reads after ungetc with multibyte characters in the buffer" do
28+
@string = StringIO.new(+"∂φ/∂x = gaîté")
29+
c = @string.getc
30+
@string.ungetc(c)
31+
@string.readpartial(3).should == "\xE2\x88\x82".b
32+
@string.readpartial(3).should == "\xCF\x86/".b
33+
end
34+
2735
it "reads after ungetc without data in the buffer" do
2836
@string = StringIO.new
2937
@string.write("f").should == 1

0 commit comments

Comments
 (0)