Fix meta_class, sis class instance variables and class methods
after some serious recursive thinking it now actually makes sense. The key was to change the actual type of the class that the meta_class manages For objects it's (still) ok just to change the instance_type, but since the class object exists and has type, when adding instance variables, that actual type has to change
This commit is contained in:
@ -36,15 +36,18 @@ module Parfait
|
||||
assert_raises{ @try.add_instance_method(nil)}
|
||||
end
|
||||
def test_add_instance_variable_changes_type
|
||||
before = @space.get_class.instance_type
|
||||
@space.get_class.add_instance_variable(:counter , :Integer)
|
||||
assert before != @space.get_class.instance_type
|
||||
before = @try.instance_type
|
||||
@try.add_instance_variable(:counter , :Integer)
|
||||
assert before != @try.instance_type
|
||||
end
|
||||
def test_add_instance_variable_changes_type_hash
|
||||
before = @space.get_class.instance_type.hash
|
||||
@space.get_class.add_instance_variable(:counter , :Integer)
|
||||
assert before != @space.get_class.instance_type.hash
|
||||
before = @try.instance_type.hash
|
||||
@try.add_instance_variable(:counter , :Integer)
|
||||
assert before != @try.instance_type.hash
|
||||
end
|
||||
def test_add_instance_variable_changes_class_type
|
||||
@try.add_instance_variable(:counter , :Integer)
|
||||
assert_equal @try.clazz.type , @try.instance_type
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user