1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix and uncomment getlocal test

Previously, under the scraper, this would side-exit because it was
returning to a C method. Now that we use the jit_func entrypoint, this
test no longer side-exits.
This commit is contained in:
John Hawthorn 2021-07-20 10:22:08 -07:00 committed by Alan Wu
parent 1891dcaa9f
commit 6aa4637272

View file

@ -55,20 +55,19 @@ class TestYJIT < Test::Unit::TestCase
assert_compiles('-"foo" == -"bar"', insns: %i[opt_eq], result: false)
end
# FIXME: currently not working
#def test_getlocal_with_level
# assert_compiles(<<~RUBY, insns: %i[getlocal opt_plus], result: [[7]], exits: {leave: 2})
# def foo(foo, bar)
# [1].map do |x|
# [1].map do |y|
# foo + bar
# end
# end
# end
#
# foo(5, 2)
# RUBY
#end
def test_getlocal_with_level
assert_compiles(<<~RUBY, insns: %i[getlocal opt_plus], result: [[7]])
def foo(foo, bar)
[1].map do |x|
[1].map do |y|
foo + bar
end
end
end
foo(5, 2)
RUBY
end
def test_string_then_nil
assert_compiles(<<~RUBY, insns: %i[opt_nil_p], result: true)