Bug #1099
closedInvalid 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
Updated by yugui (Yuki Sonoda) almost 16 years ago
=begin
The following issue was reported to the redmine4ruby-lang project but it
should be reported to ruby-core.
On 2/3/09 11:56 PM, Yauheni Akhotnikau wrote:
Bug #1099: Invalid value of StringIO#pos after StringIO#ungetc
http://redmine.ruby-lang.org/issues/show/1099Reporter: Yauheni Akhotnikau
Status: Open, Priority: NormalThis 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
endThis is the result of unit-test:
- Failure:
test_ungetc(TC_StringIO_Ungetc) [tc_stringio_ungetc.rb:13]:
<0> expected but was
<-2727104>.
--
Yugui (Yuki Sonoda) yugui@yugui.jp
http://yugui.jp
=end
Updated by nobu (Nobuyoshi Nakada) almost 16 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
Applied in changeset r22253.
=end