checking classes don't get created twice

This commit is contained in:
Torsten Ruger 2017-01-15 16:59:29 +02:00
parent 83f2459a8a
commit fc96f1d2da
2 changed files with 10 additions and 1 deletions

View File

@ -50,7 +50,9 @@ module Melon
def get_name( statement )
return nil unless statement
statement.children[1]
name = statement.children[1]
raise "Not symbol #{name}" unless name.is_a? Symbol
name
end
end

View File

@ -7,6 +7,13 @@ module Melon
Register.machine.boot
end
def test_doesnt_create_existing_clas
space_class = Parfait.object_space.get_class_by_name(:Space)
RubyCompiler.compile "class Space ; end"
clazz = Parfait.object_space.get_class_by_name(:Space)
assert_equal clazz , space_class
end
def test_creates_class_without_deriviation
RubyCompiler.compile "class Testing ; end"
clazz = Parfait.object_space.get_class_by_name(:Testing)