diff options
Diffstat (limited to 'test/ruby')
-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 af2af5c778..6d98daf233 100644 --- a/test/ruby/test_shapes.rb +++ b/test/ruby/test_shapes.rb @@ -226,6 +226,32 @@ class TestShapes < Test::Unit::TestCase end; end + def test_run_out_of_shape_rb_obj_copy_ivar + assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}") + begin; + class A + def initialize + init # Avoid right sizing + end + + def init + @a = @b = @c = @d = @e = @f = 1 + end + end + + a = A.new + + o = Object.new + i = 0 + while RubyVM::Shape.shapes_available > 1 + o.instance_variable_set(:"@i#{i}", 1) + i += 1 + end + + a.dup + end; + end + def test_use_all_shapes_module assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}") begin; |