Project

General

Profile

Actions

Bug #1099

closed

Invalid value of StringIO#pos after StringIO#ungetc

Added by eao197 (Yauheni Akhotnikau) almost 16 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
Backport:
[:]

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:

  1. Failure:
    test_ungetc(TC_StringIO_Ungetc) [tc_stringio_ungetc.rb:13]:
    <0> expected but was
    <-2727104>.
    =end
Actions #1

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/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

=end

Actions #2

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

Actions

Also available in: Atom PDF

Like0
Like0Like0