rubyx/test/melon/test_ruby_compiler.rb

33 lines
925 B
Ruby
Raw Normal View History

require_relative "helper"
module Melon
2017-01-14 19:10:34 +01:00
class TestCompiler < MiniTest::Test
2016-12-18 16:17:58 +01:00
def setup
2017-01-01 20:50:54 +01:00
Register.machine.boot
2016-12-18 16:17:58 +01:00
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
2016-12-18 16:17:58 +01:00
def test_creates_class_without_deriviation
RubyCompiler.compile "class Testing ; end"
2017-01-01 20:50:54 +01:00
clazz = Parfait.object_space.get_class_by_name(:Testing)
assert clazz , "No classes created"
assert_equal :Object , clazz.super_class_name
end
2016-12-18 16:17:58 +01:00
def test_creates_class_with_deriviation
RubyCompiler.compile "class Test2 < List ;end"
2017-01-01 20:50:54 +01:00
clazz = Parfait.object_space.get_class_by_name(:Test2)
assert clazz, "No classes created"
assert_equal :List , clazz.super_class_name
2016-12-18 16:17:58 +01:00
end
end
end