rubyx/test/ruby/test_block_statement.rb

29 lines
648 B
Ruby
Raw Normal View History

2018-06-26 19:28:27 +02:00
require_relative "helper"
module Ruby
class TestBlockStatement < MiniTest::Test
include RubyTests
2018-06-26 19:28:27 +02:00
def setup()
input = "plus_one{|arg1| arg1 + 1 } "
@lst = compile( input )
2018-06-26 19:28:27 +02:00
end
def test_block
assert_equal BlockStatement , @lst.class
end
def test_send
assert_equal SendStatement , @lst.send.class
2018-06-26 19:28:27 +02:00
end
def test_method_name
assert_equal :plus_one , @lst.send.name
2018-06-26 19:28:27 +02:00
end
def test_block_args
assert_equal [:arg1] , @lst.args
2018-06-26 19:28:27 +02:00
end
def test_block_body
assert_equal SendStatement , @lst.body.class
assert_equal 1 , @lst.body.arguments.length
2018-06-26 19:28:27 +02:00
end
end
end