From 47264c4e1ffbc34fdd83b8bada241990433d9ee3 Mon Sep 17 00:00:00 2001 From: usa Date: Wed, 3 Sep 2014 04:39:50 +0000 Subject: merge revision(s) 46151,46165: [Backport #9865] * io.c (rb_io_fileno, rb_io_inspect): non-modification does not error on frozen IO. [ruby-dev:48241] [Bug #9865] * io.c (rb_io_autoclose_p): Don't raise on frozen IO. * test/lib/minitest/unit.rb: IO#autoclose? may raise IOError. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@47368 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 17cfd28bf8..f4b65f7f36 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -1003,6 +1003,8 @@ class TestIO < Test::Unit::TestCase assert_raise(SecurityError) do safe_4 { r.inspect } end + r.freeze + assert_match(/^#$/, r.inspect) end end @@ -2556,6 +2558,21 @@ End assert_equal(2, $stderr.fileno) end + def test_frozen_fileno + bug9865 = '[ruby-dev:48241] [Bug #9865]' + with_pipe do |r,w| + fd = r.fileno + assert_equal(fd, r.freeze.fileno, bug9865) + end + end + + def test_frozen_autoclose + with_pipe do |r,w| + fd = r.fileno + assert_equal(true, r.freeze.autoclose?) + end + end + def test_sysread_locktmp bug6099 = '[ruby-dev:45297]' buf = " " * 100 -- cgit v1.2.3