test ruby method tmp creation
This commit is contained in:
parent
c3939ef622
commit
8d16ef0ae0
@ -9,21 +9,21 @@ module Rubyx
|
||||
end
|
||||
|
||||
def create_method
|
||||
RubyCompiler.compile in_Test("def meth; @ivar ;end")
|
||||
Vool::VoolCompiler.compile in_Test("def meth; @ivar ;end")
|
||||
test = Parfait.object_space.get_class_by_name(:Test)
|
||||
test.get_method(:meth)
|
||||
end
|
||||
|
||||
def create_method_arg
|
||||
RubyCompiler.compile in_Test("def meth_arg(arg); arg ;end")
|
||||
Vool::VoolCompiler.compile in_Test("def meth_arg(arg); arg ;end")
|
||||
test = Parfait.object_space.get_class_by_name(:Test)
|
||||
test.get_method(:meth_arg)
|
||||
end
|
||||
|
||||
def create_method_local
|
||||
RubyCompiler.compile in_Test("def meth_local(arg); local = 5 ;end")
|
||||
Vool::VoolCompiler.compile in_Test("def meth_local(arg); local = 5 ;end")
|
||||
test = Parfait.object_space.get_class_by_name(:Test)
|
||||
test.get_method(:meth_arg)
|
||||
test.get_method(:meth_local)
|
||||
end
|
||||
|
||||
def test_creates_method_in_class
|
||||
@ -33,7 +33,8 @@ module Rubyx
|
||||
|
||||
def test_method_has_source
|
||||
method = create_method
|
||||
assert_equal "(ivar :@ivar)", method.source.to_s
|
||||
assert_equal Vool::ScopeStatement, method.source.class
|
||||
assert_equal Vool::InstanceVariable, method.source.first.class
|
||||
end
|
||||
|
||||
def test_method_has_no_args
|
||||
@ -51,10 +52,21 @@ module Rubyx
|
||||
assert_equal 2 , method.args_type.instance_length
|
||||
end
|
||||
|
||||
def Test_method_has_locals
|
||||
def test_method_has_locals
|
||||
method = create_method_local
|
||||
assert_equal 2 , method.locals_type.instance_length
|
||||
end
|
||||
|
||||
def test_method_create_tmp
|
||||
name = create_method.create_tmp
|
||||
assert_equal "tmp_1" , name
|
||||
end
|
||||
|
||||
def test_method_add_tmp
|
||||
method = create_method_local
|
||||
method.create_tmp
|
||||
assert_equal 3 , method.locals_type.instance_length
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user