summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2024-04-11 14:30:30 -0400
committerPeter Zhu <peter@peterzhu.ca>2024-04-12 11:27:08 -0400
commitedec690e0331b5aa851b3a7c9872b2bf92f3cb21 (patch)
tree9cc4a482d069f8f72b3f4f86831ff570d72ad834 /test/ruby
parent3629d4df66a09334a764f487c431c501a60e18fe (diff)
Refactor how object IDs work for special consts
We don't need to treat static symbols in any special way since they can't be confused with other special consts or GC managed objects.
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_objectspace.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/ruby/test_objectspace.rb b/test/ruby/test_objectspace.rb
index a7cfb064a8..1c97bd517e 100644
--- a/test/ruby/test_objectspace.rb
+++ b/test/ruby/test_objectspace.rb
@@ -66,8 +66,11 @@ End
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 + GC::INTERNAL_CONSTANTS[:RVALUE_SIZE]) }
+ assert_raise_with_message(RangeError, msg) { ObjectSpace._id2ref(:a.object_id + 256) }
end
def test_count_objects