rename instance_methods to just methods
This commit is contained in:
@ -21,7 +21,7 @@ class TypeMessages < MiniTest::Test
|
||||
end
|
||||
|
||||
def test_type_methods
|
||||
assert_equal 5 , @mess.get_type.get_type.variable_index(:instance_methods)
|
||||
assert_equal 5 , @mess.get_type.get_type.variable_index(:methods)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -14,44 +14,44 @@ class TestMethodApi < MiniTest::Test
|
||||
end
|
||||
|
||||
def test_new_methods
|
||||
assert_equal @try_type.method_names.class, @try_type.instance_methods.class
|
||||
assert_equal @try_type.method_names.get_length , @try_type.instance_methods.get_length
|
||||
assert_equal @try_type.method_names.class, @try_type.methods.class
|
||||
assert_equal @try_type.method_names.get_length , @try_type.methods.get_length
|
||||
end
|
||||
|
||||
def test_add_method
|
||||
before = @try_type.instance_methods.get_length
|
||||
before = @try_type.methods.get_length
|
||||
foo = foo_method
|
||||
assert_equal foo , @try_type.add_instance_method(foo)
|
||||
assert_equal 1 , @try_type.instance_methods.get_length - before
|
||||
assert_equal foo , @try_type.add_method(foo)
|
||||
assert_equal 1 , @try_type.methods.get_length - before
|
||||
assert @try_type.method_names.inspect.include?(":foo")
|
||||
end
|
||||
def test_remove_method
|
||||
test_add_method
|
||||
assert_equal true , @try_type.remove_instance_method(:foo)
|
||||
assert_equal true , @try_type.remove_method(:foo)
|
||||
end
|
||||
def test_remove_nothere
|
||||
assert_raises RuntimeError do
|
||||
@try_type.remove_instance_method(:foo)
|
||||
@try_type.remove_method(:foo)
|
||||
end
|
||||
end
|
||||
def test_create_method
|
||||
args = Parfait::Type.for_hash( @try_class , { bar: :Integer})
|
||||
@try_type.create_instance_method :bar, args
|
||||
@try_type.create_method :bar, args
|
||||
assert @try_type.method_names.inspect.include?("bar")
|
||||
end
|
||||
def test_method_get
|
||||
test_add_method
|
||||
assert_equal Parfait::TypedMethod , @try_type.get_instance_method(:foo).class
|
||||
assert_equal Parfait::TypedMethod , @try_type.get_method(:foo).class
|
||||
end
|
||||
def test_method_get_nothere
|
||||
assert_nil @try_type.get_instance_method(:foo)
|
||||
assert_nil @try_type.get_method(:foo)
|
||||
test_remove_method
|
||||
assert_nil @try_type.get_instance_method(:foo)
|
||||
assert_nil @try_type.get_method(:foo)
|
||||
end
|
||||
def test_get_instance
|
||||
foo = foo_method :Object
|
||||
type = @space.get_class_by_name(:Object).instance_type
|
||||
type.add_instance_method(foo)
|
||||
assert_equal :foo , type.get_instance_method(:foo).name
|
||||
type.add_method(foo)
|
||||
assert_equal :foo , type.get_method(:foo).name
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user