2017-04-02 18:13:14 +02:00
|
|
|
require_relative "helper"
|
2017-04-01 15:27:32 +02:00
|
|
|
|
|
|
|
module Vool
|
|
|
|
class TestMethodStatement < MiniTest::Test
|
|
|
|
|
2017-04-06 13:02:18 +02:00
|
|
|
def basic_setup()
|
|
|
|
input = "def tryout(arg1, arg2) ; true ; false ; end "
|
2017-04-06 14:36:41 +02:00
|
|
|
@lst = RubyCompiler.compile( input )
|
2017-04-01 15:27:32 +02:00
|
|
|
end
|
2017-04-06 13:02:18 +02:00
|
|
|
def test_method
|
|
|
|
basic_setup
|
2017-04-01 15:27:32 +02:00
|
|
|
assert_equal MethodStatement , @lst.class
|
|
|
|
end
|
|
|
|
|
2017-04-06 13:02:18 +02:00
|
|
|
def test_method_name
|
|
|
|
basic_setup
|
2017-04-01 15:27:32 +02:00
|
|
|
assert_equal :tryout , @lst.name
|
|
|
|
end
|
|
|
|
|
2017-04-06 13:02:18 +02:00
|
|
|
def test_method_args
|
|
|
|
basic_setup
|
2017-04-01 15:27:32 +02:00
|
|
|
assert_equal [:arg1, :arg2] , @lst.args
|
|
|
|
end
|
2017-04-06 13:02:18 +02:00
|
|
|
def test_basic_body
|
|
|
|
basic_setup
|
|
|
|
assert_equal ScopeStatement , @lst.body.class
|
|
|
|
assert_equal 2 , @lst.body.length
|
2017-04-01 15:27:32 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|