move tests with mom_compile to mom

This commit is contained in:
Torsten Ruger
2018-07-07 22:45:48 +03:00
parent 0d900de695
commit 7231f301ba
2 changed files with 0 additions and 0 deletions

View File

@ -0,0 +1,42 @@
require_relative "helper"
module Vool
class TestBlockStatement < MiniTest::Test
include MomCompile
def setup
Parfait.boot!
@ret = compile_mom( as_test_main("self.main {|elem| elem } "))
end
def test_is_compiler
assert_equal Mom::MomCompiler , @ret.class
end
def test_has_method
assert_equal Parfait::CallableMethod , @ret.method_compilers.first.method.class
end
def test_method_has_block
assert @ret.method_compilers.first.method.blocks , "No block created"
end
end
class TestBlockCreated < MiniTest::Test
include MomCompile
def setup
Parfait.boot!
@ret = compile_mom( as_test_main("self.main {|elem| local = 5 } "))
@block = @ret.method_compilers.first.method.blocks
end
def test_block_arg_type
assert_equal Parfait::Type, @block.arguments_type.class
end
def test_block_arg_type_name
assert_equal 1, @block.arguments_type.variable_index(:elem)
end
def test_block_local_type
assert_equal Parfait::Type, @block.frame_type.class
end
def test_block_frame_type_name
assert_equal 1, @block.frame_type.variable_index(:local)
end
end
end

View File

@ -0,0 +1,25 @@
require_relative "helper"
module Vool
class TestClassStatement < MiniTest::Test
include MomCompile
def setup
Parfait.boot!
@ret = compile_mom( as_test_main("return 1"))
end
def test_return_class
assert_equal Mom::MomCompiler , @ret.class
end
def test_has_compilers
assert_equal Risc::MethodCompiler , @ret.method_compilers.first.class
end
def test_constant
assert @ret.method_compilers.first.add_constant( Parfait::Integer.new(5) )
end
end
end