bit more method collector/creation testing
This commit is contained in:
@ -20,7 +20,7 @@ module Melon
|
||||
def test_one_arg
|
||||
method = parse_collect("def meth2(arg1); 1;end").first
|
||||
assert method.name == :meth2
|
||||
assert method.args_type.variable_index(:arg1) , method.args_type.inspect
|
||||
assert_equal 2 , method.args_type.variable_index(:arg1) , method.args_type.inspect
|
||||
end
|
||||
|
||||
def test_three_args
|
||||
|
@ -8,12 +8,31 @@ module Melon
|
||||
Register.machine.boot
|
||||
end
|
||||
|
||||
def test_creates_method_in_class
|
||||
def create_method
|
||||
Compiler.compile in_Space("def meth; @ivar;end")
|
||||
space = Parfait.object_space.get_class
|
||||
method = space.get_method(:meth)
|
||||
space.get_method(:meth)
|
||||
end
|
||||
|
||||
def test_creates_method_in_class
|
||||
method = create_method
|
||||
assert method , "No method created"
|
||||
end
|
||||
|
||||
def test_method_has_source
|
||||
method = create_method
|
||||
assert_equal "(ivar :@ivar)", method.source.to_s
|
||||
end
|
||||
|
||||
def test_method_has_no_args
|
||||
method = create_method
|
||||
assert_equal 1 , method.args_type.instance_length
|
||||
end
|
||||
|
||||
def test_method_has_no_locals
|
||||
method = create_method
|
||||
assert_equal 1 , method.locals_type.instance_length
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user