bug hunting for class recreation

This commit is contained in:
Torsten Ruger 2017-01-17 21:25:58 +02:00
parent 54b8a9f6de
commit 9c83423e50
2 changed files with 17 additions and 3 deletions

View File

@ -28,5 +28,19 @@ module Melon
assert_equal :List , clazz.super_class_name assert_equal :List , clazz.super_class_name
end end
def test_space_is_unchanged_by_compile
space1 = Parfait.object_space.get_class_by_name(:Space)
RubyCompiler.compile "class Space ;end"
space2 = Parfait.object_space.get_class_by_name(:Space)
assert_equal space1 , space2
end
def test_space_type_is_unchanged_by_compile
space1 = Parfait.object_space.get_class_by_name(:Space).instance_type
RubyCompiler.compile "class Space ;end"
space2 = Parfait.object_space.get_class_by_name(:Space).instance_type
assert_equal space1 , space2
end
end end
end end

View File

@ -9,9 +9,9 @@ module Melon
end end
def create_method def create_method
RubyCompiler.compile in_Space("def meth; @ivar ;end") RubyCompiler.compile in_Test("def meth; @ivar ;end")
space = Parfait.object_space.get_class test = Parfait.object_space.get_class_by_name(:Test)
space.get_method(:meth) test.get_method(:meth)
end end
def test_creates_method_in_class def test_creates_method_in_class