cache booted functions

remove more redundant parfait boots
This commit is contained in:
2019-09-07 17:56:06 +03:00
parent 2c681bf2e5
commit b13c19def3
18 changed files with 35 additions and 32 deletions

View File

@ -6,7 +6,6 @@ module Vool
include MomCompile
def setup
Parfait.boot!(Parfait.default_test_options)
@ret = compile_mom( as_test_main("self.main {|elem| elem = 5 } "))
end
def test_is_compiler
@ -22,7 +21,6 @@ module Vool
class TestBlockLocal < MiniTest::Test
include MomCompile
def setup
Parfait.boot!(Parfait.default_test_options)
@ret = compile_mom( as_test_main("self.main {|elem| local = 5 } "))
@block = @ret.method_compilers.first.get_method.blocks
end
@ -43,7 +41,6 @@ module Vool
include MomCompile
def setup
Parfait.boot!(Parfait.default_test_options)
end
def test_method_arg_compiles
ret = compile_mom( as_test_main("self.main {|elem| arg = 5 } "))

View File

@ -5,7 +5,7 @@ module Mom
def setup
Parfait.boot!(Parfait.default_test_options)
@functions = Builtin.boot_functions
@functions = Builtin.boot_functions({})
end
def test_has_boot_function
assert @functions
@ -14,7 +14,7 @@ module Mom
assert_equal Array, @functions.class
end
def test_boot_function_length
assert_equal 22, @functions.length
assert_equal 21, @functions.length
end
def test_boot_function_first
assert_equal Mom::MethodCompiler, @functions.first.class

View File

@ -6,7 +6,6 @@ module Vool
include MomCompile
def setup
Parfait.boot!(Parfait.default_test_options)
@ret = compile_mom( as_test_main("return 1"))
end

View File

@ -5,7 +5,6 @@ module Mom
include MomCompile
def setup
Parfait.boot!(Parfait.default_test_options)
@comp = compile_mom( "class Test ; def main(); return 'Hi'; end; end;")
end
@ -13,13 +12,13 @@ module Mom
assert_equal MomCollection , @comp.class
end
def test_compilers
assert_equal 22 , @comp.compilers.length
assert_equal 23 , @comp.compilers.length
end
def test_boot_compilers
assert_equal 21 , @comp.boot_compilers.length
assert_equal 22 , @comp.boot_compilers.length
end
def test_compilers_bare
assert_equal 21 , MomCollection.new.compilers.length
assert_equal 22 , MomCollection.new.compilers.length
end
def test_append_class
assert_equal MomCollection, (@comp.append @comp).class
@ -43,7 +42,7 @@ module Mom
end
def test_has_risc_compiler
assert_equal Risc::MethodCompiler, compiler.class
assert_equal 22, @collection.method_compilers.length
assert_equal 23, @collection.method_compilers.length
end
def test_has_risc_instructions
assert_equal Risc::Label, compiler.risc_instructions.class