Add test for Ractor safety (#11762)

This commit is contained in:
Mohamed Hafez 2025-03-23 07:45:23 -03:00 committed by GitHub
parent 5f77f9bea6
commit 7e0dac4cb1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
Notes: git 2025-03-23 10:45:41 +00:00
Merged-By: eregon <eregontp@gmail.com>

View File

@ -51,4 +51,19 @@ class TestRbConfig < Test::Unit::TestCase
assert_match(/\$\(sitearch|\$\(rubysitearchprefix\)/, val, "#{key} #{bug7823}")
end
end
def test_limits_and_sizeof_access_in_ractor
assert_separately(["-W0"], <<~'RUBY')
r = Ractor.new do
sizeof_int = RbConfig::SIZEOF["int"]
fixnum_max = RbConfig::LIMITS["FIXNUM_MAX"]
[sizeof_int, fixnum_max]
end
sizeof_int, fixnum_max = r.take
assert_kind_of Integer, sizeof_int, "RbConfig::SIZEOF['int'] should be an Integer"
assert_kind_of Integer, fixnum_max, "RbConfig::LIMITS['FIXNUM_MAX'] should be an Integer"
RUBY
end if defined?(Ractor)
end