summaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-15 05:58:00 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-15 05:58:00 +0000
commite2f40d88894700b532d7c187aef3e2a5e8be1d5a (patch)
tree93e83f3ed141511424a35051c1e878244a1b41da /test/ruby
parentb26f447d8c28305427201f97624268604143aab1 (diff)
downloadruby-e2f40d88894700b532d7c187aef3e2a5e8be1d5a.tar.gz
ruby-e2f40d88894700b532d7c187aef3e2a5e8be1d5a.tar.xz
ruby-e2f40d88894700b532d7c187aef3e2a5e8be1d5a.zip
* io.c (io_reopen): unread current buffer before telling the
position, for the case of reopening same file. [ruby-dev:39479] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_io.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 8b1714b01..71f31e37a 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -1286,6 +1286,15 @@ class TestIO < Test::Unit::TestCase
assert_equal("bar\n", f.gets, '[ruby-core:24240]')
}
end
+
+ open(__FILE__) do |f|
+ f2 = open(t.path)
+ f.reopen(f2)
+ assert_equal("foo\n", f.gets)
+ assert_equal("bar\n", f.gets)
+ f.reopen(f2)
+ assert_equal("baz\n", f.gets, '[ruby-dev:39479]')
+ end
end
def test_foreach