summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-14 14:26:51 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-14 14:26:51 +0000
commit71263844e25ab69259257328f4f180b5a7ecbd7a (patch)
tree8582070fffa290f6b51438188b3df1db59db00f0
parent755a86b87a38fa55d3380e657f19eca63dfee0e0 (diff)
* 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
-rw-r--r--ChangeLog5
-rw-r--r--test/ruby/test_objectspace.rb15
2 files changed, 20 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 50040a2358..6df5d341d6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/test/ruby/test_objectspace.rb b/test/ruby/test_objectspace.rb
index a2d0164954..6c28d63108 100644
--- a/test/ruby/test_objectspace.rb
+++ b/test/ruby/test_objectspace.rb
@@ -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