Slotted constructor cleanup

This commit is contained in:
2020-02-17 14:45:54 +07:00
parent c1679bd6ff
commit 2d11078a37
13 changed files with 26 additions and 22 deletions

View File

@ -3,7 +3,7 @@ require_relative "helper"
module SlotMachine
class TestNotSameCheck < SlotMachineInstructionTest
def instruction
target = Slotted.for(:message , :caller)
target = Slotted.for(:message , [:caller])
NotSameCheck.new(target , target , Label.new("ok" , "target"))
end
def test_len

View File

@ -3,7 +3,7 @@ require_relative "helper"
module SlotMachine
class TestSameCheck < SlotMachineInstructionTest
def instruction
target = SlottedMessage.new( :caller)
target = SlottedMessage.new( [:caller])
TruthCheck.new(target , Label.new("ok" , "target"))
end
def test_len

View File

@ -3,13 +3,13 @@ require_relative "helper"
module SlotMachine
class TestSlotted < MiniTest::Test
def test_to_s
assert_equal "message.caller" , SlottedMessage.new(:caller).to_s
assert_equal "message.caller" , SlottedMessage.new([:caller]).to_s
end
def test_for_mess
assert_equal 2 , SlottedMessage.new(:caller).slots_length
assert_equal 2 , SlottedMessage.new([:caller]).slots_length
end
def test_for_const
slotted = Slotted.for(StringConstant.new("hi") , [])
slotted = Slotted.for(StringConstant.new("hi") , nil)
assert_equal "StringConstant" , slotted.to_s
end
end

View File

@ -6,7 +6,7 @@ module SlotMachine
def setup
Parfait.boot!(Parfait.default_test_options)
compiler = Risc::FakeCompiler.new
@slotted = Slotted.for(StringConstant.new("hi") , [])
@slotted = Slotted.for(StringConstant.new("hi") , nil)
register = @slotted.to_register(compiler , InstructionMock.new)
@instruction = compiler.instructions.first
end

View File

@ -3,7 +3,7 @@ require_relative "helper"
module SlotMachine
class TestSlottedMessage < MiniTest::Test
def slotted(slot = :caller)
def slotted(slot = [:caller])
SlottedMessage.new(slot)
end
def test_create_ok1

View File

@ -5,7 +5,7 @@ module SlotMachine
def setup
Parfait.boot!(Parfait.default_test_options)
compiler = Risc::FakeCompiler.new
slotted = SlottedMessage.new(:caller)
slotted = SlottedMessage.new([:caller])
@register = slotted.to_register(compiler , "fake source")
@instruction = compiler.instructions.first
end