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

test/ruby/test_jit.rb: Add a test for checkmatch insn

This commit is contained in:
Yusuke Endoh 2021-10-25 21:30:16 +09:00
parent 5bcef26d24
commit 1c0c8d5da2

View file

@ -609,6 +609,17 @@ class TestJIT < Test::Unit::TestCase
assert_eval_with_jit('print "\x00".unpack("c")', stdout: '[0]', success_count: 1)
end
def test_compile_insn_checkmatch
assert_compile_once("#{<<~"begin;"}\n#{<<~"end;"}", result_inspect: '"world"', insns: %i[checkmatch])
begin;
ary = %w(hello good-bye)
case 'hello'
when *ary
'world'
end
end;
end
def test_jit_output
out, err = eval_with_jit('5.times { puts "MJIT" }', verbose: 1, min_calls: 5)
assert_equal("MJIT\n" * 5, out)