diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-10-16 06:13:41 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-10-16 06:13:41 +0000 |
commit | ede6826186a7a2f4380d23a9f46f0bc4b9e50473 (patch) | |
tree | ab927e710a93c10287c421bc4522840d946be73b /test/objspace | |
parent | e775a930e1631f11b3bb9e2a0feb260f5a5df769 (diff) |
* ext/objspace/objspace.c: add a new method `reachable_objects_from_root'.
ObjectSpace.reachable_objects_from_root returns all objects refered
from root (called "root objects").
This feature is for deep object analysis.
* test/objspace/test_objspace.rb: add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/objspace')
-rw-r--r-- | test/objspace/test_objspace.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/objspace/test_objspace.rb b/test/objspace/test_objspace.rb index 861e40e62b..5a0660ed52 100644 --- a/test/objspace/test_objspace.rb +++ b/test/objspace/test_objspace.rb @@ -97,6 +97,18 @@ class TestObjSpace < Test::Unit::TestCase eom end + def test_reachable_objects_from_root + root_objects = ObjectSpace.reachable_objects_from_root + + assert_operator(root_objects.size, :>, 0) + + root_objects.each{|category, objects| + assert_kind_of(String, category) + assert_kind_of(Array, objects) + assert_operator(objects.size, :>, 0) + } + end + def test_reachable_objects_size assert_separately %w[--disable-gem -robjspace], __FILE__, __LINE__, <<-'eom' ObjectSpace.each_object{|o| |