rubyx/test/ruby/test_yield_statement.rb

25 lines
550 B
Ruby
Raw Normal View History

2018-06-28 19:15:24 +02:00
require_relative "helper"
module Ruby
class TestYieldStatementX < MiniTest::Test
include RubyTests
2018-06-28 19:15:24 +02:00
def setup()
input = "def plus_one; yield(0) ; end "
@lst = compile( input )
2018-06-28 19:15:24 +02:00
end
def test_method
assert_equal MethodStatement , @lst.class
end
def test_block
assert_equal YieldStatement , @lst.body.class
end
def test_block_args
assert_equal IntegerConstant , @lst.body.arguments.first.class
end
def test_method_yield?
assert_equal true , @lst.has_yield?
end
end
end