rename typed_method to callable_method
seems to make the essence clearer also extracted base class
This commit is contained in:
@ -8,7 +8,7 @@ module Parfait
|
||||
@obj = Parfait.object_space.get_class_by_name(:Object).instance_type
|
||||
@args = Parfait::Type.for_hash( @obj.object_class , { bar: :Integer , foo: :Type})
|
||||
@frame = Parfait::Type.for_hash( @obj.object_class , { local_bar: :Integer , local_foo: :Type})
|
||||
@method = Parfait::TypedMethod.new( @obj , :meth , @args , @frame)
|
||||
@method = Parfait::CallableMethod.new( @obj , :meth , @args , @frame)
|
||||
end
|
||||
|
||||
def test_method_name
|
||||
@ -99,7 +99,7 @@ module Parfait
|
||||
assert_equal @method , @method
|
||||
end
|
||||
def test_not_equal
|
||||
method = Parfait::TypedMethod.new( @obj , :other , @args , @frame)
|
||||
method = Parfait::CallableMethod.new( @obj , :other , @args , @frame)
|
||||
assert @method != method
|
||||
end
|
||||
end
|
@ -4,9 +4,10 @@ module Parfait
|
||||
class TestSpace < ParfaitTest
|
||||
|
||||
def classes
|
||||
[:Word,:List,:Message,:Integer,:ReturnAddress,:DataObject,:Data4,:Data8,
|
||||
:TrueClass,:FalseClass,:NilClass,:Object,:BinaryCode,:Space,:NamedList,
|
||||
:Type,:Class,:Dictionary,:CacheEntry,:TypedMethod,:VoolMethod]
|
||||
[:BinaryCode,:CacheEntry,:Callable,:CallableMethod,:Class,
|
||||
:DataObject,:Data4,:Data8,:Data16,:Dictionary,:Integer,:FalseClass,
|
||||
:List,:Message,:NamedList,:NilClass,:Object,:ReturnAddress,
|
||||
:Space,:TrueClass,:Type,:VoolMethod,:Word]
|
||||
end
|
||||
|
||||
def test_space_length
|
||||
|
@ -22,13 +22,13 @@ module Parfait
|
||||
end
|
||||
|
||||
def test_name
|
||||
assert_equal "Word_Type" , @types.values.first.name
|
||||
assert_equal "BinaryCode_Type" , @types.values.first.name
|
||||
end
|
||||
|
||||
def test_to_hash
|
||||
hash = @first.to_hash
|
||||
assert_equal hash[:type] , :Type
|
||||
assert_equal 3 , hash.length
|
||||
assert_equal 2 , hash.length
|
||||
end
|
||||
def test_add_is_different
|
||||
type = @first.add_instance_variable :random , :Integer
|
||||
|
@ -14,7 +14,7 @@ module Parfait
|
||||
end
|
||||
def foo_method( for_class = :Try)
|
||||
args = Parfait::Type.for_hash( @try_class , { bar: :Integer})
|
||||
::Parfait::TypedMethod.new( @space.get_class_by_name(for_class).instance_type , :foo , args,empty_frame)
|
||||
::Parfait::CallableMethod.new( @space.get_class_by_name(for_class).instance_type , :foo , args,empty_frame)
|
||||
end
|
||||
def add_foo_to( clazz = :Try )
|
||||
foo = foo_method( clazz )
|
||||
@ -50,7 +50,7 @@ module Parfait
|
||||
end
|
||||
def test_method_get
|
||||
add_foo_to
|
||||
assert_equal Parfait::TypedMethod , @try_type.get_method(:foo).class
|
||||
assert_equal Parfait::CallableMethod , @try_type.get_method(:foo).class
|
||||
end
|
||||
def test_method_get_nothere
|
||||
assert_nil @try_type.get_method(:foo)
|
||||
|
Reference in New Issue
Block a user