diff options
author | Maxime Chevalier-Boisvert <[email protected]> | 2023-11-22 14:06:37 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2023-11-22 19:06:37 +0000 |
commit | 7a93bee4f845f496742b03a0e575ed13631971b7 (patch) | |
tree | 07698d0e3f9c811e8cd59effde06b33aca7092dc | |
parent | 3720d4c39af7e88f4be98f5d8e1d8a3d47db5208 (diff) |
YJIT: add an extra btest for shape too complex (#9013)
Following Jean Boussier's comment that some shape bugs were not
caught by our tests, I'm trying to improve our test coverage a
tiny bit.
-rw-r--r-- | bootstraptest/test_yjit.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb index a2a05c45d7..a7ef90ba74 100644 --- a/bootstraptest/test_yjit.rb +++ b/bootstraptest/test_yjit.rb @@ -278,6 +278,33 @@ assert_equal '["instance-variable", 5]', %q{ Foo.new.foo } +# getinstancevariable with shape too complex +assert_normal_exit %q{ + class Foo + def initialize + @a = 1 + end + + def getter + @foobar + end + end + + # Initialize ivars in changing order, making the Foo + # class have shape too complex + 100.times do |x| + foo = Foo.new + foo.instance_variable_set(:"@a#{x}", 1) + foo.instance_variable_set(:"@foobar", 777) + + # The getter method eventually sees shape too complex + r = foo.getter + if r != 777 + raise "error" + end + end +} + assert_equal '0', %q{ # This is a regression test for incomplete invalidation from # opt_setinlinecache. This test might be brittle, so |