From 7e0dac4cb18be87600068c346cd5339d1d880f01 Mon Sep 17 00:00:00 2001 From: Mohamed Hafez Date: Sun, 23 Mar 2025 07:45:23 -0300 Subject: [PATCH] Add test for Ractor safety (#11762) --- test/test_rbconfig.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/test_rbconfig.rb b/test/test_rbconfig.rb index 1bbf01b9a6..7dbd525e99 100644 --- a/test/test_rbconfig.rb +++ b/test/test_rbconfig.rb @@ -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