improves method compiler tests
This commit is contained in:
parent
f8b3fa1877
commit
c7978c22d4
@ -1,3 +1,4 @@
|
|||||||
require_relative "helper"
|
require_relative "helper"
|
||||||
require_relative "test_ivar_collect"
|
require_relative "test_ivar_collect"
|
||||||
require_relative "test_local_collect"
|
require_relative "test_local_collect"
|
||||||
|
require_relative "test_method_compiler"
|
||||||
|
@ -18,26 +18,31 @@ module Vool
|
|||||||
clazz = VoolCompiler.compile in_Test("def meth; @ivar ;end")
|
clazz = VoolCompiler.compile in_Test("def meth; @ivar ;end")
|
||||||
assert_equal Parfait::Class , clazz.body.clazz.class
|
assert_equal Parfait::Class , clazz.body.clazz.class
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_creates_method_in_class
|
def test_creates_method_in_class
|
||||||
method = create_method
|
method = create_method
|
||||||
assert method , "No method created"
|
assert method , "No method created"
|
||||||
|
assert_equal Rubyx::RubyMethod , method.class
|
||||||
end
|
end
|
||||||
|
def test_method_has_source
|
||||||
def pest_method_has_source
|
|
||||||
method = create_method
|
method = create_method
|
||||||
assert_equal "(ivar :@ivar)", method.source.to_s
|
assert_equal Vool::InstanceVariable , method.source.class
|
||||||
end
|
end
|
||||||
|
|
||||||
def pest_method_has_no_args
|
def test_method_has_no_args
|
||||||
method = create_method
|
method = create_method
|
||||||
assert_equal 1 , method.args_type.instance_length
|
assert_equal 1 , method.args_type.instance_length
|
||||||
end
|
end
|
||||||
|
|
||||||
def pest_method_has_no_locals
|
def test_method_has_no_locals
|
||||||
method = create_method
|
method = create_method
|
||||||
assert_equal 1 , method.locals_type.instance_length
|
assert_equal 1 , method.locals_type.instance_length
|
||||||
end
|
end
|
||||||
|
def test_method_has_one_local
|
||||||
|
VoolCompiler.compile in_Test("def meth; local = 5 ;end")
|
||||||
|
test = Parfait.object_space.get_class_by_name(:Test)
|
||||||
|
method = test.get_method(:meth)
|
||||||
|
assert_equal 2 , method.locals_type.instance_length
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
@ -1,4 +1,3 @@
|
|||||||
require_relative "helper"
|
require_relative "helper"
|
||||||
require_relative "statements/test_all"
|
require_relative "statements/test_all"
|
||||||
require_relative "compilers/test_all"
|
require_relative "compilers/test_all"
|
||||||
require_relative "test_vool_compiler"
|
|
||||||
|
Loading…
Reference in New Issue
Block a user