Change test to avoid stack overflow with MN threads

When using MN threads (such as running the test in a ractor), this test
failed because it was raising a SystemStackError: stack level too deep.

This is because the machine stack is smaller under MN threads than on
the native main thread.
This commit is contained in:
Étienne Barrié 2025-05-23 15:58:05 +02:00 committed by Jean Boussier
parent f64c89f18d
commit 2a951f62e1
Notes: git 2025-05-23 19:28:29 +00:00

View File

@ -2138,7 +2138,9 @@ class TestHashOnly < Test::Unit::TestCase
def test_iterlevel_in_ivar_bug19589 def test_iterlevel_in_ivar_bug19589
h = { a: nil } h = { a: nil }
hash_iter_recursion(h, 200) # Recursion level should be over 127 to actually test iterlevel being set in an instance variable,
# but it should be under 131 not to overflow the stack under MN threads/ractors.
hash_iter_recursion(h, 130)
assert true assert true
end end