summaryrefslogtreecommitdiff
path: root/test/ruby/test_jit.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_jit.rb')
-rw-r--r--test/ruby/test_jit.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ruby/test_jit.rb b/test/ruby/test_jit.rb
index 888290faa9..5c31b504c4 100644
--- a/test/ruby/test_jit.rb
+++ b/test/ruby/test_jit.rb
@@ -669,6 +669,27 @@ class TestJIT < Test::Unit::TestCase
end;
end
+ def test_inlined_undefined_ivar
+ assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: "bbb", success_count: 2, min_calls: 3)
+ begin;
+ class Foo
+ def initialize
+ @a = :a
+ end
+
+ def bar
+ if @b.nil?
+ @b = :b
+ end
+ end
+ end
+
+ print(Foo.new.bar)
+ print(Foo.new.bar)
+ print(Foo.new.bar)
+ end;
+ end
+
def test_attr_reader
assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: "4nil\nnil\n6", success_count: 2, min_calls: 2)
begin;