summaryrefslogtreecommitdiff
path: root/test/ruby/test_shapes.rb
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2023-10-30 14:55:13 +0100
committerPeter Zhu <[email protected]>2023-10-31 12:07:54 -0400
commitac7f913ca3af970225c9cc93b92eb5c403894180 (patch)
tree181136e97e58eff8f672684d475ed38dd9362a07 /test/ruby/test_shapes.rb
parent4aacc559d99988f395eced3534c7a6938bd356c8 (diff)
Handle SHAPE_TOO_COMPLEX in `generic_ivar_set`
Diffstat (limited to 'test/ruby/test_shapes.rb')
-rw-r--r--test/ruby/test_shapes.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ruby/test_shapes.rb b/test/ruby/test_shapes.rb
index 6d98daf233..b9ac1cafe1 100644
--- a/test/ruby/test_shapes.rb
+++ b/test/ruby/test_shapes.rb
@@ -226,6 +226,26 @@ class TestShapes < Test::Unit::TestCase
end;
end
+ def test_run_out_of_shape_generic_ivar_set
+ assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}")
+ begin;
+ class TooComplex < Hash
+ end
+
+ # Try to run out of shapes
+ o = Object.new
+ i = 0
+ while RubyVM::Shape.shapes_available > 0
+ o.instance_variable_set(:"@i#{i}", 1)
+ i += 1
+ end
+
+ tc = TooComplex.new
+ tc.instance_variable_set(:@a, 1)
+ tc.instance_variable_set(:@b, 2)
+ end;
+ end
+
def test_run_out_of_shape_rb_obj_copy_ivar
assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}")
begin;