Actions
Bug #1099
closedInvalid value of StringIO#pos after StringIO#ungetc
Bug #1099:
Invalid value of StringIO#pos after StringIO#ungetc
Description
=begin
This unit test is passed under Ruby 1.8.7 and failed under Ruby 1.9.1-p0 (mswin32):
require 'stringio'
require 'test/unit'
class TC_StringIO_Ungetc < Test::Unit::TestCase
def test_ungetc
b = '\b00010001 \B00010001 \b1 \B1 \b000100011'
s = StringIO.new( b )
expected_pos = 0
while n = s.getc
assert_equal( expected_pos + 1, s.pos )
s.ungetc( n )
assert_equal( expected_pos, s.pos )
assert_equal( n, s.getc )
expected_pos += 1
end
end
end
This is the result of unit-test:
- Failure:
test_ungetc(TC_StringIO_Ungetc) [tc_stringio_ungetc.rb:13]:
<0> expected but was
<-2727104>.
=end
Actions