summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_io.rb17
1 files changed, 17 insertions, 0 deletions
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