mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* io.c (rb_io_initialize): don't accept IO object. [ruby-dev:35895]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18883 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f6f85ad683
commit
d05d66e2ac
3 changed files with 19 additions and 67 deletions
|
@ -1189,31 +1189,6 @@ class TestIO < Test::Unit::TestCase
|
|||
|
||||
assert_equal("foo\nbar\nbaz\n", File.read(t.path))
|
||||
|
||||
with_pipe do |r, w|
|
||||
assert_raise(RuntimeError) do
|
||||
o = Object.new
|
||||
class << o; self; end.instance_eval do
|
||||
define_method(:to_io) { r }
|
||||
end
|
||||
w.instance_eval { initialize(o) }
|
||||
end
|
||||
end
|
||||
|
||||
pipe(proc do |w|
|
||||
w = IO.new(w)
|
||||
w.puts "foo"
|
||||
w.puts "bar"
|
||||
w.puts "baz"
|
||||
w.close
|
||||
end, proc do |r|
|
||||
r = IO.new(r)
|
||||
assert_equal("foo\nbar\nbaz\n", r.read)
|
||||
end)
|
||||
|
||||
with_pipe do |r, w|
|
||||
assert_raise(ArgumentError) { IO.new(r, "r+") }
|
||||
end
|
||||
|
||||
f = open(t.path)
|
||||
assert_raise(RuntimeError) do
|
||||
f.instance_eval { initialize }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue