summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohamed Hafez <mohamed.m.m.hafez@gmail.com>2025-03-23 07:45:23 -0300
committerGitHub <noreply@github.com>2025-03-23 10:45:23 +0000
commit7e0dac4cb18be87600068c346cd5339d1d880f01 (patch)
tree41974320968647d98c8e809116987d629fe72ca1
parent5f77f9bea61fb4cc8447a76e191fdfb28f076862 (diff)
Add test for Ractor safety (#11762)
Notes
Notes: Merged-By: eregon <eregontp@gmail.com>
-rw-r--r--test/test_rbconfig.rb15
1 files changed, 15 insertions, 0 deletions
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