From d24f4c0fe3594a1e2fef7cfbef521d71cb4f0abf Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 4 Sep 2009 21:29:29 +0000 Subject: * io.c (rb_io_binmode): check if closed regardless platforms. [ruby-core:25363] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@24751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_io.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 6e69f14437..7137b5f772 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -1,5 +1,6 @@ require 'test/unit' require 'tmpdir' +require 'tempfile' class TestIO < Test::Unit::TestCase def mkcdtmpdir @@ -17,4 +18,20 @@ class TestIO < Test::Unit::TestCase assert_equal("\377", r.gets("\377"), "[ruby-dev:24460]") r.close end + + def make_tempfile + t = Tempfile.new("foo") + t.binmode + t.puts "foo" + t.puts "bar" + t.puts "baz" + t.close + t + end + + def test_binmode_after_closed + t = make_tempfile + t.close + assert_raise(IOError) {t.binmode} + end end -- cgit v1.2.3