rubyx/stash/test_rubyx/test_ruby_compiler.rb
Torsten Ruger 112ec26bd1 deprecating ruby package
to be replaced by vool and mom
2017-08-31 16:18:59 +03:00

47 lines
1.4 KiB
Ruby

require_relative "helper"
module Rubyx
class TestCompiler #< MiniTest::Test
def setup
Risc.machine.boot
end
def test_doesnt_create_existing_clas
space_class = Parfait.object_space.get_class_by_name(:Space)
RubyxCompiler.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
RubyxCompiler.compile "class Testing ; end"
clazz = Parfait.object_space.get_class_by_name(:Testing)
assert clazz , "No classes created"
assert_equal :Object , clazz.super_class_name
end
def test_creates_class_with_deriviation
RubyxCompiler.compile "class Test2 < List ;end"
clazz = Parfait.object_space.get_class_by_name(:Test2)
assert clazz, "No classes created"
assert_equal :List , clazz.super_class_name
end
def test_space_is_unchanged_by_compile
space1 = Parfait.object_space.get_class_by_name(:Space)
RubyxCompiler.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
RubyxCompiler.compile "class Space ;end"
space2 = Parfait.object_space.get_class_by_name(:Space).instance_type
assert_equal space1 , space2
end
end
end