rubyx/test/vool/send/helper.rb
Torsten Rüger fa0aa30386 Move builtin wholesale to Mom
Since Builtin generates risc, just like mom instructions, it was a design mistake to put builtin into risc in the first place. Now that borders are coming more into focus, it make much more sense to have the builtin in mom.
In fact the instructions should be moved out and a seperate invocation mechanism used , so functions can be parsed, not generated (wip)
2019-08-12 12:38:29 +03:00

48 lines
1.3 KiB
Ruby

require_relative "../helper"
module Vool
# relies on @ins and receiver_type method
module SimpleSendHarness
include VoolCompile
include Mom
def setup
Parfait.boot!(Parfait.default_test_options)
Mom.boot!
@compiler = compile_first_method( send_method )
@ins = @compiler.mom_instructions.next
end
def test_first_not_array
assert Array != @ins.class , @ins
end
def test_class_compiles
assert_equal MessageSetup , @ins.class , @ins
end
def test_two_instructions_are_returned
assert_equal 6 , @ins.length , @ins
end
def test_receiver_move_class
assert_equal ArgumentTransfer, @ins.next(1).class
end
def test_receiver_move
assert_equal SlotDefinition, @ins.next.receiver.class
end
def test_receiver
type , value = receiver
assert_equal type, @ins.next.receiver.known_object.class
assert_equal value, @ins.next.receiver.known_object.value
end
def test_call_is
assert_equal SimpleCall, @ins.next(2).class
end
def test_call_has_method
assert_equal Parfait::CallableMethod, @ins.next(2).method.class
end
def test_array
check_array [MessageSetup,ArgumentTransfer,SimpleCall,Label, ReturnSequence ,
Label] , @ins
end
end
end