Fix SystemStackError in test_run_out_of_shape_for_class_cvar

This commit is contained in:
Peter Zhu 2023-11-01 13:47:26 -04:00
parent 52e127280b
commit 909afcb4fc

View File

@ -278,13 +278,15 @@ class TestShapes < Test::Unit::TestCase
def test_run_out_of_shape_for_class_cvar
assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}")
begin;
c = Class.new
i = 0
while RubyVM::Shape.shapes_available > 0
c = Class.new
c.class_variable_set(:"@@i#{i}", 1)
i += 1
end
c = Class.new
c.class_variable_set(:@@a, 1)
assert_equal(1, c.class_variable_get(:@@a))