summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-12 10:41:48 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-12 10:41:48 +0000
commit39bd52f06949aeff90c5dc9be3a262c53ddfd9c5 (patch)
tree71a3db433966b125519bc344e52c2b9835b9e32a /test
parent98d4159e9065357d29f388be7b5d2c5643226ee7 (diff)
downloadruby-39bd52f06949aeff90c5dc9be3a262c53ddfd9c5.tar.gz
ruby-39bd52f06949aeff90c5dc9be3a262c53ddfd9c5.tar.xz
ruby-39bd52f06949aeff90c5dc9be3a262c53ddfd9c5.zip
* test/stringio/test_stringio.rb (test_ungetc_pos): added.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/stringio/test_stringio.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/stringio/test_stringio.rb b/test/stringio/test_stringio.rb
index 98cf84e00..1c19fad5c 100644
--- a/test/stringio/test_stringio.rb
+++ b/test/stringio/test_stringio.rb
@@ -394,4 +394,19 @@ class TestStringIO < Test::Unit::TestCase
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