improve C0 coverage of insns.def
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7b1372b0ac
commit
d3ae13571f
@ -18,7 +18,6 @@ fsl = { frozen_string_literal: true } # used later
|
|||||||
tests = [
|
tests = [
|
||||||
# insn , expression to generate such insn
|
# insn , expression to generate such insn
|
||||||
[ 'nop', %q{ raise rescue true }, ],
|
[ 'nop', %q{ raise rescue true }, ],
|
||||||
[ 'trace', %q{ true }, ],
|
|
||||||
|
|
||||||
[ 'setlocal *, 0', %q{ x = true }, ],
|
[ 'setlocal *, 0', %q{ x = true }, ],
|
||||||
[ 'setlocal *, 1', %q{ x = nil; -> { x = true }.call }, ],
|
[ 'setlocal *, 1', %q{ x = nil; -> { x = true }.call }, ],
|
||||||
@ -27,6 +26,27 @@ tests = [
|
|||||||
[ 'getlocal *, 1', %q{ x = true; -> { x }.call }, ],
|
[ 'getlocal *, 1', %q{ x = true; -> { x }.call }, ],
|
||||||
[ 'getlocal', %q{ x = true; -> { -> { x }.() }.() }, ],
|
[ 'getlocal', %q{ x = true; -> { -> { x }.() }.() }, ],
|
||||||
|
|
||||||
|
[ 'setblockparam', <<~'},', ], # {
|
||||||
|
def m&b
|
||||||
|
b = # here
|
||||||
|
proc { true }
|
||||||
|
end
|
||||||
|
m { false }.call
|
||||||
|
},
|
||||||
|
[ 'getblockparam', <<~'},', ], # {
|
||||||
|
def m&b
|
||||||
|
b # here
|
||||||
|
end
|
||||||
|
m { true }.call
|
||||||
|
},
|
||||||
|
[ 'getblockparamproxy', <<~'},', ], # {
|
||||||
|
def m&b
|
||||||
|
b # here
|
||||||
|
.call
|
||||||
|
end
|
||||||
|
m { true }
|
||||||
|
},
|
||||||
|
|
||||||
[ 'setspecial', %q{ true if true..true }, ],
|
[ 'setspecial', %q{ true if true..true }, ],
|
||||||
[ 'getspecial', %q{ $&.nil? }, ],
|
[ 'getspecial', %q{ $&.nil? }, ],
|
||||||
[ 'getspecial', %q{ $`.nil? }, ],
|
[ 'getspecial', %q{ $`.nil? }, ],
|
||||||
@ -70,6 +90,7 @@ tests = [
|
|||||||
[ 'freezestring', %q{ "#{true}" }, fsl, ],
|
[ 'freezestring', %q{ "#{true}" }, fsl, ],
|
||||||
[ 'freezestring', %q{ "#{true}" }, '-d', fsl, ],
|
[ 'freezestring', %q{ "#{true}" }, '-d', fsl, ],
|
||||||
[ 'toregexp', %q{ /#{true}/ =~ "true" && $~ }, ],
|
[ 'toregexp', %q{ /#{true}/ =~ "true" && $~ }, ],
|
||||||
|
[ 'intern', %q{ :"#{true}" }, ],
|
||||||
|
|
||||||
[ 'newarray', %q{ ["true"][0] }, ],
|
[ 'newarray', %q{ ["true"][0] }, ],
|
||||||
[ 'duparray', %q{ [ true ][0] }, ],
|
[ 'duparray', %q{ [ true ][0] }, ],
|
||||||
@ -97,7 +118,6 @@ tests = [
|
|||||||
[ 'pop', %q{ def x; true; end; x }, ],
|
[ 'pop', %q{ def x; true; end; x }, ],
|
||||||
[ 'dup', %q{ x = y = true; x }, ],
|
[ 'dup', %q{ x = y = true; x }, ],
|
||||||
[ 'dupn', %q{ Object::X ||= true }, ],
|
[ 'dupn', %q{ Object::X ||= true }, ],
|
||||||
[ 'dupn', %q{ Object::X ||= true }, ],
|
|
||||||
[ 'reverse', %q{ q, (w, e), r = 1, [2, 3], 4; e == 3 }, ],
|
[ 'reverse', %q{ q, (w, e), r = 1, [2, 3], 4; e == 3 }, ],
|
||||||
[ 'swap', <<~'},', ], # {
|
[ 'swap', <<~'},', ], # {
|
||||||
x = [[false, true]]
|
x = [[false, true]]
|
||||||
@ -113,6 +133,7 @@ tests = [
|
|||||||
|
|
||||||
[ 'defined', %q{ !defined?(x) }, ],
|
[ 'defined', %q{ !defined?(x) }, ],
|
||||||
[ 'checkkeyword', %q{ def x x:rand;x end; x x: true }, ],
|
[ 'checkkeyword', %q{ def x x:rand;x end; x x: true }, ],
|
||||||
|
[ 'checktype', %q{ x = true; "#{x}" }, ],
|
||||||
[ 'checkmatch', <<~'},', ], # {
|
[ 'checkmatch', <<~'},', ], # {
|
||||||
x = y = true
|
x = y = true
|
||||||
case x
|
case x
|
||||||
@ -384,6 +405,15 @@ tests = [
|
|||||||
class String; def =~ other; true; end; end
|
class String; def =~ other; true; end; end
|
||||||
'true' =~ /true/
|
'true' =~ /true/
|
||||||
},
|
},
|
||||||
|
|
||||||
|
[ 'opt_call_c_function', 'Struct.new(:x).new.x = true', ],
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# normal path
|
||||||
tests.compact.each {|(insn, expr, *a)| assert_equal 'true', expr, insn, *a }
|
tests.compact.each {|(insn, expr, *a)| assert_equal 'true', expr, insn, *a }
|
||||||
|
|
||||||
|
# with trace
|
||||||
|
tests.compact.each {|(insn, expr, *a)|
|
||||||
|
progn = "set_trace_func(proc{})\n" + expr
|
||||||
|
assert_equal 'true', progn, insn, *a
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user