1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/stringio/stringio.c (strio_init): rewind when reopened.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@17103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2008-06-11 18:30:10 +00:00
parent 05f4cafde0
commit f9ac9e2dfc
4 changed files with 22 additions and 3 deletions

View file

@ -40,4 +40,17 @@ class TestStringIO < Test::Unit::TestCase
end
assert_equal("hacker\nother ruby\n", stringio.string)
end
def test_reopen
f = StringIO.new("foo\nbar\nbaz\n")
assert_equal("foo\n", f.gets)
f.reopen("qux\nquux\nquuux\n")
assert_equal("qux\n", f.gets)
f2 = StringIO.new("")
f2.reopen(f)
assert_equal("quux\n", f2.gets)
ensure
f.close unless f.closed?
end
end