Revert "Allow IO#reopen to take a block"
This reverts r59142. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
02fa3456ce
commit
2fd3a2e2f7
1
NEWS
1
NEWS
@ -44,7 +44,6 @@ with all sufficient information, see the ChangeLog file or Redmine
|
|||||||
|
|
||||||
* IO#pread [Feature #4532]
|
* IO#pread [Feature #4532]
|
||||||
* IO#pwrite [Feature #4532]
|
* IO#pwrite [Feature #4532]
|
||||||
* IO#reopen takes a block [Feature #2631]
|
|
||||||
|
|
||||||
* IOError
|
* IOError
|
||||||
|
|
||||||
|
4
io.c
4
io.c
@ -7058,10 +7058,6 @@ rb_io_reopen(int argc, VALUE *argv, VALUE file)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rb_block_given_p()) {
|
|
||||||
return rb_ensure(rb_yield, file, io_close, file);
|
|
||||||
}
|
|
||||||
|
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2156,22 +2156,6 @@ class TestIO < Test::Unit::TestCase
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_reopen_with_block
|
|
||||||
make_tempfile {|t|
|
|
||||||
open(__FILE__) do |f|
|
|
||||||
f.gets
|
|
||||||
assert_nothing_raised {
|
|
||||||
reopened = nil
|
|
||||||
f.reopen(t.path) do |_reopened|
|
|
||||||
reopened = _reopened
|
|
||||||
assert_equal("foo\n", reopened.gets)
|
|
||||||
end
|
|
||||||
assert_equal(true, reopened.closed?)
|
|
||||||
}
|
|
||||||
end
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_reopen_inherit
|
def test_reopen_inherit
|
||||||
mkcdtmpdir {
|
mkcdtmpdir {
|
||||||
system(EnvUtil.rubybin, '-e', <<"End")
|
system(EnvUtil.rubybin, '-e', <<"End")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user