diff --git a/test/stdlib/IO_test.rb b/test/stdlib/IO_test.rb index 2e40ece55..962333e0f 100644 --- a/test/stdlib/IO_test.rb +++ b/test/stdlib/IO_test.rb @@ -35,19 +35,16 @@ def test_binwrite def test_open Dir.mktmpdir do |dir| - fd = IO.sysopen(File.expand_path(__FILE__)) - assert_send_type "(Integer) -> IO", - IO, :open, fd + IO, :open, IO.sysopen(File.expand_path(__FILE__)) assert_send_type "(ToInt, String) -> IO", - IO, :open, ToInt.new(fd), "r" + IO, :open, ToInt.new(IO.sysopen(File.expand_path(__FILE__))), "r" assert_send_type "(Integer) { (IO) -> Integer } -> Integer", - IO, :open, fd do |io| io.read.size end + IO, :open, IO.sysopen(File.expand_path(__FILE__)), &proc {|io| io.read.size } - fd = IO.sysopen(File.expand_path(__FILE__)) assert_send_type( "(ToInt, path: String) -> IO", - IO, :open, ToInt.new(fd), path: "<>" + IO, :open, ToInt.new(IO.sysopen(File.expand_path(__FILE__))), path: "<>" ) end end