diff options
Diffstat (limited to 'test/ruby/test_shapes.rb')
-rw-r--r-- | test/ruby/test_shapes.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/ruby/test_shapes.rb b/test/ruby/test_shapes.rb index 85adcd4a80..0e7a2d0b0c 100644 --- a/test/ruby/test_shapes.rb +++ b/test/ruby/test_shapes.rb @@ -108,6 +108,32 @@ class TestShapes < Test::Unit::TestCase assert_false RubyVM::Shape.of(obj).too_complex? end + def test_removing_when_too_many_ivs_on_class + obj = Class.new + + (RubyVM::Shape::SHAPE_MAX_NUM_IVS + 2).times do + obj.instance_variable_set(:"@a#{_1}", 1) + end + (RubyVM::Shape::SHAPE_MAX_NUM_IVS + 2).times do + obj.remove_instance_variable(:"@a#{_1}") + end + + assert_empty obj.instance_variables + end + + def test_removing_when_too_many_ivs_on_module + obj = Module.new + + (RubyVM::Shape::SHAPE_MAX_NUM_IVS + 2).times do + obj.instance_variable_set(:"@a#{_1}", 1) + end + (RubyVM::Shape::SHAPE_MAX_NUM_IVS + 2).times do + obj.remove_instance_variable(:"@a#{_1}") + end + + assert_empty obj.instance_variables + end + def test_too_complex_ractor assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}") begin; |