2018-07-01 10:59:52 +02:00
|
|
|
require_relative "helper"
|
|
|
|
|
|
|
|
module Mom
|
2018-07-01 20:26:45 +02:00
|
|
|
class TestMomCompiler < MiniTest::Test
|
2018-07-01 10:59:52 +02:00
|
|
|
include MomCompile
|
|
|
|
|
|
|
|
def setup
|
|
|
|
Parfait.boot!
|
2018-07-03 09:12:22 +02:00
|
|
|
@comp = compile_mom( "class Test ; def main(); return 'Hi'; end; end;")
|
2018-07-01 10:59:52 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_class
|
2018-07-01 20:26:45 +02:00
|
|
|
assert_equal MomCompiler , @comp.class
|
2018-07-01 10:59:52 +02:00
|
|
|
end
|
|
|
|
def test_compilers
|
2018-07-01 20:51:48 +02:00
|
|
|
assert_equal 24 , @comp.method_compilers.length
|
2018-07-01 10:59:52 +02:00
|
|
|
end
|
2018-07-03 09:12:22 +02:00
|
|
|
def test_returns_constants
|
|
|
|
assert_equal Array , @comp.constants.class
|
|
|
|
end
|
|
|
|
def test_has_constant
|
|
|
|
assert_equal "Hi" , @comp.constants.first.to_string
|
|
|
|
end
|
2018-07-01 10:59:52 +02:00
|
|
|
def test_has_translate
|
|
|
|
assert @comp.translate(:interpreter)
|
|
|
|
end
|
2018-07-01 13:12:42 +02:00
|
|
|
end
|
2018-07-01 10:59:52 +02:00
|
|
|
end
|