fix a whole bunch of vool to_mom

All but those requiring boot functions
This commit is contained in:
Torsten Rüger
2019-08-07 15:08:45 +03:00
parent 1237e079f7
commit d5625a70d7
26 changed files with 134 additions and 131 deletions

View File

@ -2,39 +2,28 @@ require_relative "helper"
module Mom
class TestMethodCompiler < MiniTest::Test
include MomCompile
include ScopeHelper
def setup
Parfait.boot!(Parfait.default_test_options)
@comp = compile_mom( "class Test ; def main(); return 'Hi'; end; end;")
end
def test_class
assert_equal MomCompiler , @comp.class
def in_test_vool(str)
vool = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_vool(in_Test(str))
vool.to_mom(nil)
vool
end
def test_compilers
assert_equal 23 , @comp.compilers.length
def in_test_mom(str)
FIXMERubyX::RubyXCompiler.new(in_Test(str)).ruby_to_mom()
end
def test_boot_compilers
assert_equal 22 , @comp.boot_compilers.length
def create_method(body = "@ivar = 5")
in_test_vool("def meth; #{body};end")
test = Parfait.object_space.get_class_by_name(:Test)
test.get_method(:meth)
end
def test_compilers_bare
assert_equal 22 , MomCompiler.new.compilers.length
end
def test_returns_constants
assert_equal Array , @comp.constants.class
end
def test_has_constant
assert_equal "Hi" , @comp.constants[1].to_string
end
def test_has_translate
assert @comp.translate(:interpreter)
end
def test_append_class
assert_equal MomCompiler, (@comp.append @comp).class
end
def test_append_length
assert_equal 2 , @comp.append(@comp).method_compilers.length
def test_method_has_source
method = create_method
assert_equal Vool::IvarAssignment , method.source.class
end
end
end