From 53163f8138e1e0d1c0f91351a8cfe8749151d56e Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 16 Jul 2009 07:00:23 +0000 Subject: * io.c (io_reopen): discards read buffer. [ruby-core:24240] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_io.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 8a5b878f3b..42614e00cb 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -1270,6 +1270,16 @@ class TestIO < Test::Unit::TestCase assert_equal("foo\n", f.gets) } end + + open(__FILE__) do |f| + f.gets + f2 = open(t.path) + f2.gets + assert_nothing_raised { + f.reopen(f2) + assert_equal("bar\n", f.gets, '[ruby-core:24240]') + } + end end def test_foreach -- cgit v1.2.3