Bug #1099
closed
Invalid value of StringIO#pos after StringIO#ungetc
Added by eao197 (Yauheni Akhotnikau) over 15 years ago.
Updated over 13 years ago.
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
=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/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:
- Failure:
test_ungetc(TC_StringIO_Ungetc) [tc_stringio_ungetc.rb:13]:
<0> expected but was
<-2727104>.
http://redmine.ruby-lang.org
--
Yugui (Yuki Sonoda) yugui@yugui.jp
http://yugui.jp
=end
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
Applied in changeset r22253.
=end
Also available in: Atom
PDF
Like0
Like0Like0