vool method fix
This commit is contained in:
parent
488af5b8f7
commit
3683aa8976
@ -19,7 +19,7 @@ module Vool
|
|||||||
def on_def( statement )
|
def on_def( statement )
|
||||||
name , args , body = *statement
|
name , args , body = *statement
|
||||||
arg_array = process_all( args )
|
arg_array = process_all( args )
|
||||||
MethodStatement.new( name , arg_array , body )
|
MethodStatement.new( name , arg_array , process(body) )
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_arg( arg )
|
def on_arg( arg )
|
||||||
|
@ -3,26 +3,28 @@ require_relative "helper"
|
|||||||
module Vool
|
module Vool
|
||||||
class TestMethodStatement < MiniTest::Test
|
class TestMethodStatement < MiniTest::Test
|
||||||
|
|
||||||
def setup
|
def basic_setup()
|
||||||
input = "def tryout(arg1, arg2) ; end "
|
input = "def tryout(arg1, arg2) ; true ; false ; end "
|
||||||
@lst = Compiler.compile( input )
|
@lst = Compiler.compile( input )
|
||||||
end
|
end
|
||||||
|
def test_method
|
||||||
def test_compile_method
|
basic_setup
|
||||||
assert_equal MethodStatement , @lst.class
|
assert_equal MethodStatement , @lst.class
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_compile_method_name
|
def test_method_name
|
||||||
|
basic_setup
|
||||||
assert_equal :tryout , @lst.name
|
assert_equal :tryout , @lst.name
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_compile_method_super
|
def test_method_args
|
||||||
|
basic_setup
|
||||||
assert_equal [:arg1, :arg2] , @lst.args
|
assert_equal [:arg1, :arg2] , @lst.args
|
||||||
end
|
end
|
||||||
|
def test_basic_body
|
||||||
def test_compile_method_body
|
basic_setup
|
||||||
assert_equal [] , @lst.body
|
assert_equal ScopeStatement , @lst.body.class
|
||||||
|
assert_equal 2 , @lst.body.length
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user