mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test_jit.rb: test local variables
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
db8e95587e
commit
d54e22860c
1 changed files with 17 additions and 4 deletions
|
@ -19,10 +19,6 @@ class TestJIT < Test::Unit::TestCase
|
|||
:answer,
|
||||
|
||||
# TODO: write tests for them
|
||||
:getlocal,
|
||||
:setlocal,
|
||||
:getlocal_WC_1,
|
||||
:setlocal_WC_1,
|
||||
:reput,
|
||||
:tracecoverage,
|
||||
]
|
||||
|
@ -57,6 +53,23 @@ class TestJIT < Test::Unit::TestCase
|
|||
foo = 1
|
||||
foo
|
||||
end;
|
||||
|
||||
insns = %i[setlocal getlocal setlocal_WC_0 getlocal_WC_0 setlocal_WC_1 getlocal_WC_1]
|
||||
assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", success_count: 3, stdout: '168', insns: insns)
|
||||
begin;
|
||||
def foo
|
||||
a = 0
|
||||
[1, 2].each do |i|
|
||||
a += i
|
||||
[3, 4].each do |j|
|
||||
a *= j
|
||||
end
|
||||
end
|
||||
a
|
||||
end
|
||||
|
||||
print foo
|
||||
end;
|
||||
end
|
||||
|
||||
def test_compile_insn_blockparam
|
||||
|
|
Loading…
Add table
Reference in a new issue