2018-06-28 19:15:24 +02:00
|
|
|
require_relative "helper"
|
|
|
|
|
2018-07-19 13:46:51 +02:00
|
|
|
module Ruby
|
2018-07-07 16:57:46 +02:00
|
|
|
class TestYieldStatementX < MiniTest::Test
|
2018-06-29 21:46:39 +02:00
|
|
|
include RubyTests
|
2018-06-28 19:15:24 +02:00
|
|
|
|
|
|
|
def setup()
|
|
|
|
input = "def plus_one; yield(0) ; end "
|
2018-06-29 21:46:39 +02:00
|
|
|
@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
|