From: "Yugui (Yuki Sonoda)" Date: 2009-02-04T09:51:50+09:00 Subject: [ruby-core:21819] Re: [redmine4ruby-lang:236] [Bug #1099] Invalid value of StringIO#pos after StringIO#ungetc 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/1099 > > Reporter: Yauheni Akhotnikau > Status: Open, Priority: Normal > > 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: > > 1) Failure: > test_ungetc(TC_StringIO_Ungetc) [tc_stringio_ungetc.rb:13]: > <0> expected but was > <-2727104>. > > > ---------------------------------------- > http://redmine.ruby-lang.org > -- Yugui (Yuki Sonoda) http://yugui.jp