diff --git a/library/stringio/readpartial_spec.rb b/library/stringio/readpartial_spec.rb index 988c55223..645f983d8 100644 --- a/library/stringio/readpartial_spec.rb +++ b/library/stringio/readpartial_spec.rb @@ -1,3 +1,4 @@ +# encoding: binary require_relative '../../spec_helper' require_relative 'fixtures/classes' @@ -24,6 +25,14 @@ @string.readpartial(3).should == ", l" end + it "reads after ungetc with multibyte characters in the buffer" do + @string = StringIO.new(+"∂φ/∂x = gaîté") + c = @string.getc + @string.ungetc(c) + @string.readpartial(3).should == "\xE2\x88\x82" + @string.readpartial(3).should == "\xCF\x86/" + end + it "reads after ungetc without data in the buffer" do @string = StringIO.new @string.write("f").should == 1