From f15d04358827d60a708f296973c420b2c031ac5e Mon Sep 17 00:00:00 2001 From: k0kubun Date: Sat, 6 Apr 2019 02:53:32 +0000 Subject: Cover all insns in test_jit again git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_jit.rb | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'test/ruby') diff --git a/test/ruby/test_jit.rb b/test/ruby/test_jit.rb index 5b5c21d76d..0079741a04 100644 --- a/test/ruby/test_jit.rb +++ b/test/ruby/test_jit.rb @@ -183,14 +183,34 @@ class TestJIT < Test::Unit::TestCase assert_compile_once('2', result_inspect: '2', insns: %i[putobject]) end - def test_compile_insn_definemethod - assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: 'hello', success_count: 2, insns: %i[definemethod]) + def test_compile_insn_definemethod_definesmethod + assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: 'helloworld', success_count: 3, insns: %i[definemethod definesmethod]) begin; print 1.times.map { def method_definition 'hello' end - method_definition + + def self.smethod_definition + 'world' + end + + method_definition + smethod_definition + }.join + end; + end + + def test_compile_insn_putspecialobject + assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: 'a', success_count: 2, insns: %i[putspecialobject]) + begin; + print 1.times.map { + def a + 'a' + end + + alias :b :a + + b }.join end; end @@ -970,8 +990,7 @@ class TestJIT < Test::Unit::TestCase insns = iseq_array.last.select { |x| x.is_a?(Array) }.map(&:first) iseq_array.last.each do |(insn, *args)| case insn - when :definemethod, :definesmethod, - :send + when :definemethod, :definesmethod, :send insns += collect_insns(args.last) end end -- cgit v1.2.3