Files
mruby-mruby/test/t/codegen.rb
T
Yukihiro "Matz" Matsumoto cc2786c84e resolve conflict; ref #3285
2016-11-25 09:25:51 +09:00

34 lines
591 B
Ruby

##
# Codegen tests
assert('peephole optimization does not eliminate move whose result is reused') do
assert_raise LocalJumpError do
def method
yield
end
method(&a &&= 0)
end
end
assert('empty condition in ternary expression parses correctly') do
assert_equal(() ? 1 : 2, 2)
end
assert('codegen absorbs arguments to redo and retry if they are the argument of a call') do
assert_nothing_raised do
a=*"1", case nil
when 1
redo |
1
end
end
assert_nothing_raised do
a=*"1", case nil
when 1
retry |
1
end
end
end