refactor send vool tests

This commit is contained in:
Torsten Ruger 2018-04-26 20:26:42 +03:00
parent 26fe77ed68
commit 08d0aae79e
5 changed files with 23 additions and 29 deletions

View File

@ -1,6 +1,15 @@
require_relative "../helper"
module Vool
# relies on @ins and receiver_type method
module SimpleSendHarness
include MomCompile
def setup
Risc.machine.boot
@ins = compile_first_method( send_method )
end
def test_compiles_not_array
assert Array != @ins.class , @ins
end

View File

@ -1,18 +1,12 @@
require_relative "../helper"
require_relative "simple_send_harness"
require_relative "helper"
module Vool
class TestSendSelfMom < MiniTest::Test
include MomCompile
include SimpleSendHarness
include Mom
def do_setup(str)
Risc.machine.boot
@ins = compile_first_method( str)
end
def setup
do_setup("self.get_internal_word(0)")
def send_method
"self.get_internal_word(0)"
end
def test_receiver
assert_equal SlotDefinition, @ins.next.receiver.class
@ -32,8 +26,8 @@ module Vool
end
class TestSendSelfImplicitMom < TestSendSelfMom
def setup
do_setup( "get_internal_word(0)")
def send_method
"get_internal_word(0)"
end
end
end

View File

@ -1,14 +1,11 @@
require_relative "../helper"
require_relative "simple_send_harness"
require_relative "helper"
module Vool
class TestSendSimpleMom < MiniTest::Test
include MomCompile
include SimpleSendHarness
def setup
Risc.machine.boot
@ins = compile_first_method( "5.div4")
def send_method
"5.div4"
end
def receiver
[Mom::IntegerConstant , 5]

View File

@ -1,14 +1,11 @@
require_relative "../helper"
require_relative "simple_send_harness"
require_relative "helper"
module Vool
class TestSendSimpleArgsMom < MiniTest::Test
include MomCompile
include SimpleSendHarness
def setup
Risc.machine.boot
@ins = compile_first_method( "5.div4(1,2)")
def send_method
"5.div4(1,2)"
end
def receiver

View File

@ -1,14 +1,11 @@
require_relative "../helper"
require_relative "simple_send_harness"
require_relative "helper"
module Vool
class TestSendSimpleStringArgsMom < MiniTest::Test
include MomCompile
include SimpleSendHarness
def setup
Risc.machine.boot
@ins = compile_first_method( "'5'.get_internal_byte(1)")
def send_method
"'5'.get_internal_byte(1)"
end
def receiver
[Mom::StringConstant , "5"]