fix many tests with preloading

preloading, something akin to builtin, loads some very small predefined (macro) methods for the tests to work (ie call)
This commit is contained in:
2019-09-12 22:27:10 +03:00
parent e33b9f565d
commit 4bf23defc8
42 changed files with 98 additions and 126 deletions

View File

@ -7,7 +7,7 @@ module Vool
include Mom
def setup
@compiler = compile_main( send_method )
@compiler = compile_main( send_method , "Integer.div4;Object.get")
@ins = @compiler.mom_instructions.next
end

View File

@ -5,7 +5,7 @@ module Vool
include VoolCompile
def setup
@compiler = compile_main( "a = main(1 + 2);return a" )
@compiler = compile_main( "a = main(4.div4);return a" , "Integer.div4")
@ins = @compiler.mom_instructions.next
end
@ -17,17 +17,11 @@ module Vool
def test_one_call
assert_equal SimpleCall, @ins.next(2).class
assert_equal :+, @ins.next(2).method.name
assert_equal :div4 , @ins.next(2).method.name
end
def test_two_call
assert_equal SimpleCall, @ins.next(6).class
assert_equal :main, @ins.next(6).method.name
end
def test_args_one_l
left = @ins.next(1).arguments[0].left
assert_equal Symbol, left.known_object.class
assert_equal :message, left.known_object
assert_equal [:next_message, :arg1], left.slots
end
end
end

View File

@ -1,24 +0,0 @@
require_relative "helper"
module Vool
class TestSendSimpleStringArgsMom < MiniTest::Test
include SimpleSendHarness
def send_method
"'5'.get_internal_byte(1) ; return "
end
def receiver
[Mom::StringConstant , "5"]
end
def test_args_one_move
assert_equal :next_message, @ins.next.arguments[0].left.slots[0]
assert_equal :arg1, @ins.next.arguments[0].left.slots[1]
end
def test_args_one_str
assert_equal Mom::IntegerConstant, @ins.next.arguments[0].right.known_object.class
assert_equal 1, @ins.next.arguments[0].right.known_object.value
assert_equal [:next_message, :arg1], @ins.next.arguments[0].left.slots
end
end
end