From d54e22860c895a4bb3e583a7ad9886b9ea518a77 Mon Sep 17 00:00:00 2001 From: k0kubun Date: Wed, 2 May 2018 16:27:33 +0000 Subject: test_jit.rb: test local variables git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_jit.rb | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/ruby/test_jit.rb b/test/ruby/test_jit.rb index 64ed277a75..4699de7d2a 100644 --- a/test/ruby/test_jit.rb +++ b/test/ruby/test_jit.rb @@ -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 -- cgit v1.2.3