ruby-changes:10691
From: nobu <ko1@a...>
Date: Thu, 12 Feb 2009 19:41:55 +0900 (JST)
Subject: [ruby-changes:10691] Ruby:r22254 (trunk): * test/stringio/test_stringio.rb (test_ungetc_pos): added.
nobu 2009-02-12 19:41:48 +0900 (Thu, 12 Feb 2009) New Revision: 22254 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22254 Log: * test/stringio/test_stringio.rb (test_ungetc_pos): added. Modified files: trunk/test/stringio/test_stringio.rb Index: test/stringio/test_stringio.rb =================================================================== --- test/stringio/test_stringio.rb (revision 22253) +++ test/stringio/test_stringio.rb (revision 22254) @@ -394,4 +394,19 @@ def test_method assert_equal(:ok, C.new.foo, 'Bug #632 [ruby-core:19282]') end + + def test_ungetc_pos + 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/