Skip to content

Commit 7e0dac4

Browse files
authored
Add test for Ractor safety (#11762)
1 parent 5f77f9b commit 7e0dac4

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/test_rbconfig.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,19 @@ def test_vendorarchdirs
5151
assert_match(/\$\(sitearch|\$\(rubysitearchprefix\)/, val, "#{key} #{bug7823}")
5252
end
5353
end
54+
55+
def test_limits_and_sizeof_access_in_ractor
56+
assert_separately(["-W0"], <<~'RUBY')
57+
r = Ractor.new do
58+
sizeof_int = RbConfig::SIZEOF["int"]
59+
fixnum_max = RbConfig::LIMITS["FIXNUM_MAX"]
60+
[sizeof_int, fixnum_max]
61+
end
62+
63+
sizeof_int, fixnum_max = r.take
64+
65+
assert_kind_of Integer, sizeof_int, "RbConfig::SIZEOF['int'] should be an Integer"
66+
assert_kind_of Integer, fixnum_max, "RbConfig::LIMITS['FIXNUM_MAX'] should be an Integer"
67+
RUBY
68+
end if defined?(Ractor)
5469
end

0 commit comments

Comments
 (0)