diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-12-24 08:54:26 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-12-24 08:54:26 +0000 |
commit | cea49f7ca653df88fa0432e673179dde86b6c4ff (patch) | |
tree | c7b49f0ff7e18aa02bd93bfaf7517c1f3f4ec0f4 /test | |
parent | fe8e1058231a9ce40725ae6780ed2505ef79e882 (diff) |
merge revision(s) 17103:
* ext/stringio/stringio.c (strio_init): rewind when reopened.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@26171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/stringio/test_stringio.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/stringio/test_stringio.rb b/test/stringio/test_stringio.rb index de15ab5508..4c67d19c60 100644 --- a/test/stringio/test_stringio.rb +++ b/test/stringio/test_stringio.rb @@ -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 |