ruby-changes:4526
From: ko1@a...
Date: Mon, 14 Apr 2008 23:27:14 +0900 (JST)
Subject: [ruby-changes:4526] mame - Ruby:r16019 (trunk): * test/ruby/test_objectspace.rb: add a test for
mame 2008-04-14 23:26:51 +0900 (Mon, 14 Apr 2008) New Revision: 16019 Modified files: trunk/ChangeLog trunk/test/ruby/test_objectspace.rb Log: * test/ruby/test_objectspace.rb: add a test for ObjectSpace.count_objects. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=16019&r2=16018&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/ruby/test_objectspace.rb?r1=16019&r2=16018&diff_format=u Index: ChangeLog =================================================================== --- ChangeLog (revision 16018) +++ ChangeLog (revision 16019) @@ -1,3 +1,8 @@ +Mon Apr 14 23:25:50 2008 Yusuke Endoh <mame@t...> + + * test/ruby/test_objectspace.rb: add a test for + ObjectSpace.count_objects. + Mon Apr 14 22:44:24 2008 Yukihiro Matsumoto <matz@r...> * file.c (SET_EXTERNAL_ENCODING): avoid call rb_enc_check() on Index: test/ruby/test_objectspace.rb =================================================================== --- test/ruby/test_objectspace.rb (revision 16018) +++ test/ruby/test_objectspace.rb (revision 16019) @@ -33,4 +33,19 @@ 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/