summaryrefslogtreecommitdiff
path: root/test/objspace
diff options
context:
space:
mode:
authorcharliesome <charliesome@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-10 21:55:51 +0000
committercharliesome <charliesome@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-10 21:55:51 +0000
commitc8c539a19813a0ff44e05f9639a56d686876d4e1 (patch)
tree3372dd215133e9367797d9ec9ad6f1ef46bf841b /test/objspace
parentd8182739c79e6b34f48dcae446fa135a2d056ba6 (diff)
ext/objspace: Check fptr before trying to dump FILE object fd
Patch by Scott Francis. Closes GH-562. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/objspace')
-rw-r--r--test/objspace/test_objspace.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/objspace/test_objspace.rb b/test/objspace/test_objspace.rb
index 42dc55d..ea89a87 100644
--- a/test/objspace/test_objspace.rb
+++ b/test/objspace/test_objspace.rb
@@ -266,4 +266,15 @@ class TestObjSpace < Test::Unit::TestCase
File.unlink(output)
end
end
+
+ def test_dump_uninitialized_file
+ assert_in_out_err(%[-robjspace], <<-RUBY) do |output, error|
+ puts ObjectSpace.dump(File.allocate)
+ RUBY
+ assert_equal [], error
+ json = JSON.load(output.join)
+ assert_equal "FILE", json["type"]
+ assert_nil json["fd"]
+ end
+ end
end