diff options
Diffstat (limited to 'test/ruby/test_objectspace.rb')
-rw-r--r-- | test/ruby/test_objectspace.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/test/ruby/test_objectspace.rb b/test/ruby/test_objectspace.rb index 24a190b2df..1c97bd517e 100644 --- a/test/ruby/test_objectspace.rb +++ b/test/ruby/test_objectspace.rb @@ -65,6 +65,14 @@ End assert_raise_with_message(TypeError, msg) {ObjectSpace._id2ref(Object.new)} end + def test_id2ref_invalid_symbol_id + # RB_STATIC_SYM_P checks for static symbols by checking that the bottom + # 8 bits of the object is equal to RUBY_SYMBOL_FLAG, so we need to make + # sure that the bottom 8 bits remain unchanged. + msg = /is not symbol id value/ + assert_raise_with_message(RangeError, msg) { ObjectSpace._id2ref(:a.object_id + 256) } + end + def test_count_objects h = {} ObjectSpace.count_objects(h) @@ -219,7 +227,7 @@ End assert_same(new_obj, found[0]) end - def test_each_object_no_gabage + def test_each_object_no_garbage assert_separately([], <<-End) GC.disable eval('begin; 1.times{}; rescue; ensure; end') |