ruby-changes:51120
From: k0kubun <ko1@a...>
Date: Thu, 3 May 2018 01:27:39 +0900 (JST)
Subject: [ruby-changes:51120] k0kubun:r63327 (trunk): test_jit.rb: test local variables
k0kubun 2018-05-03 01:27:33 +0900 (Thu, 03 May 2018) New Revision: 63327 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63327 Log: test_jit.rb: test local variables Modified files: trunk/test/ruby/test_jit.rb Index: test/ruby/test_jit.rb =================================================================== --- test/ruby/test_jit.rb (revision 63326) +++ test/ruby/test_jit.rb (revision 63327) @@ -19,10 +19,6 @@ class TestJIT < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L19 :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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_jit.rb#L53 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/