vool method fix

This commit is contained in:
Torsten Ruger 2017-04-06 14:02:18 +03:00
parent 488af5b8f7
commit 3683aa8976
2 changed files with 13 additions and 11 deletions

View File

@ -19,7 +19,7 @@ module Vool
def on_def( statement )
name , args , body = *statement
arg_array = process_all( args )
MethodStatement.new( name , arg_array , body )
MethodStatement.new( name , arg_array , process(body) )
end
def on_arg( arg )

View File

@ -3,26 +3,28 @@ require_relative "helper"
module Vool
class TestMethodStatement < MiniTest::Test
def setup
input = "def tryout(arg1, arg2) ; end "
def basic_setup()
input = "def tryout(arg1, arg2) ; true ; false ; end "
@lst = Compiler.compile( input )
end
def test_compile_method
def test_method
basic_setup
assert_equal MethodStatement , @lst.class
end
def test_compile_method_name
def test_method_name
basic_setup
assert_equal :tryout , @lst.name
end
def test_compile_method_super
def test_method_args
basic_setup
assert_equal [:arg1, :arg2] , @lst.args
end
def test_compile_method_body
assert_equal [] , @lst.body
def test_basic_body
basic_setup
assert_equal ScopeStatement , @lst.body.class
assert_equal 2 , @lst.body.length
end
end
end