summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-05-02 16:27:33 +0000
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-05-02 16:27:33 +0000
commitd54e22860c895a4bb3e583a7ad9886b9ea518a77 (patch)
tree3f06baec119602d2d2c892fe973da53ddadbdfae /test
parentdb8e95587ee9fd8b392624b7594412e55a377bd7 (diff)
test_jit.rb: test local variables
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_jit.rb21
1 files changed, 17 insertions, 4 deletions
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