summaryrefslogtreecommitdiff
path: root/test/ruby/test_shapes.rb
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2023-11-02 17:38:24 +0100
committerJean Boussier <[email protected]>2023-11-02 19:57:14 +0100
commit0cb1fc3850db6367fa720bf3b603bb1fde2ef813 (patch)
treed3469453b772c3372ade9cb09559a133b720749c /test/ruby/test_shapes.rb
parent4c3cc25ea2bc176aa699d14f155b566655936a38 (diff)
Fix vm_getivar to handle module with TOO_COMPLEX shape
Diffstat (limited to 'test/ruby/test_shapes.rb')
-rw-r--r--test/ruby/test_shapes.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ruby/test_shapes.rb b/test/ruby/test_shapes.rb
index 09a99c4855..4967b404e2 100644
--- a/test/ruby/test_shapes.rb
+++ b/test/ruby/test_shapes.rb
@@ -275,6 +275,25 @@ class TestShapes < Test::Unit::TestCase
end;
end
+ def test_run_out_of_shape_for_module_ivar
+ assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}")
+ begin;
+ o = Object.new
+ i = 0
+ while RubyVM::Shape.shapes_available > 0
+ o.instance_variable_set(:"@i#{i}", 1)
+ i += 1
+ end
+
+ module Foo
+ @a = 1
+ @b = 2
+ assert_equal 1, @a
+ assert_equal 2, @b
+ end
+ end;
+ end
+
def test_run_out_of_shape_for_class_cvar
assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}")
begin;