1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* test/ruby/test_objectspace.rb: add a test for

ObjectSpace.count_objects.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2008-04-14 14:26:51 +00:00
parent 755a86b87a
commit 71263844e2
2 changed files with 20 additions and 0 deletions

View file

@ -1,3 +1,8 @@
Mon Apr 14 23:25:50 2008 Yusuke Endoh <mame@tsg.ne.jp>
* test/ruby/test_objectspace.rb: add a test for
ObjectSpace.count_objects.
Mon Apr 14 22:44:24 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* file.c (SET_EXTERNAL_ENCODING): avoid call rb_enc_check() on

View file

@ -33,4 +33,19 @@ End
deftest_id2ref(true)
deftest_id2ref(false)
deftest_id2ref(nil)
def test_count_objects
h = {}
ObjectSpace.count_objects(h)
assert_kind_of(Hash, h)
assert(h.keys.all? {|x| x.is_a?(Symbol) || x.is_a?(Integer) })
assert(h.values.all? {|x| x.is_a?(Integer) })
h = ObjectSpace.count_objects
assert_kind_of(Hash, h)
assert(h.keys.all? {|x| x.is_a?(Symbol) || x.is_a?(Integer) })
assert(h.values.all? {|x| x.is_a?(Integer) })
assert_raise(TypeError) { ObjectSpace.count_objects(1) }
end
end