fix more api ripples from typed method
This commit is contained in:
parent
9989cc12e0
commit
8c53b4ab67
@ -5,9 +5,8 @@ class TestMethod < MiniTest::Test
|
|||||||
def setup
|
def setup
|
||||||
obj = Parfait.object_space.get_class_by_name(:Object).instance_type
|
obj = Parfait.object_space.get_class_by_name(:Object).instance_type
|
||||||
args = Parfait::Type.for_hash( obj.object_class , { bar: :Integer , foo: :Type})
|
args = Parfait::Type.for_hash( obj.object_class , { bar: :Integer , foo: :Type})
|
||||||
@method = ::Parfait::TypedMethod.new obj , :meth , args
|
frame = Parfait::Type.for_hash( obj.object_class , { local_bar: :Integer , local_foo: :Type})
|
||||||
@method.add_local :local_bar , :Integer
|
@method = Parfait::TypedMethod.new( obj , :meth , args , frame)
|
||||||
@method.add_local :local_foo , :Type
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_method_name
|
def test_method_name
|
||||||
|
@ -9,9 +9,12 @@ class TestMethodApi < MiniTest::Test
|
|||||||
@try_type = @try_class.instance_type
|
@try_type = @try_class.instance_type
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def empty_frame
|
||||||
|
Parfait::Type.for_hash( @try_class , { })
|
||||||
|
end
|
||||||
def foo_method( for_class = :Try)
|
def foo_method( for_class = :Try)
|
||||||
args = Parfait::Type.for_hash( @try_class , { bar: :Integer})
|
args = Parfait::Type.for_hash( @try_class , { bar: :Integer})
|
||||||
::Parfait::TypedMethod.new @space.get_class_by_name(for_class).instance_type , :foo , args
|
::Parfait::TypedMethod.new( @space.get_class_by_name(for_class).instance_type , :foo , args,empty_frame)
|
||||||
end
|
end
|
||||||
def add_foo_to( clazz = :Try )
|
def add_foo_to( clazz = :Try )
|
||||||
foo = foo_method( clazz )
|
foo = foo_method( clazz )
|
||||||
@ -42,7 +45,7 @@ class TestMethodApi < MiniTest::Test
|
|||||||
end
|
end
|
||||||
def test_create_method
|
def test_create_method
|
||||||
args = Parfait::Type.for_hash( @try_class , { bar: :Integer})
|
args = Parfait::Type.for_hash( @try_class , { bar: :Integer})
|
||||||
@try_type.create_method :bar, args
|
@try_type.create_method :bar, args , empty_frame
|
||||||
assert @try_type.method_names.inspect.include?("bar")
|
assert @try_type.method_names.inspect.include?("bar")
|
||||||
end
|
end
|
||||||
def test_method_get
|
def test_method_get
|
||||||
|
Loading…
x
Reference in New Issue
Block a user