2019-02-23 17:17:26 +01:00
|
|
|
require_relative "../helper"
|
|
|
|
|
|
|
|
module Vool
|
|
|
|
# relies on @ins and receiver_type method
|
|
|
|
|
|
|
|
module ClassHarness
|
2019-08-12 10:57:32 +02:00
|
|
|
include VoolCompile
|
2019-02-23 17:17:26 +01:00
|
|
|
|
|
|
|
def setup
|
|
|
|
Parfait.boot!(Parfait.default_test_options)
|
2019-08-12 10:57:32 +02:00
|
|
|
Risc.boot!
|
|
|
|
@compiler = compile_first_method( send_method )
|
|
|
|
@ins = @compiler.mom_instructions.next
|
2019-02-23 17:17:26 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_first_not_array
|
|
|
|
assert Array != @ins.class , @ins
|
|
|
|
end
|
|
|
|
def test_class_compiles
|
|
|
|
assert_equal Mom::MessageSetup , @ins.class , @ins
|
|
|
|
end
|
|
|
|
def test_two_instructions_are_returned
|
2019-08-12 10:57:32 +02:00
|
|
|
assert_equal 6 , @ins.length , @ins
|
2019-02-23 17:17:26 +01:00
|
|
|
end
|
|
|
|
def test_receiver_move_class
|
|
|
|
assert_equal Mom::ArgumentTransfer, @ins.next(1).class
|
|
|
|
end
|
|
|
|
def test_receiver_move
|
|
|
|
assert_equal Mom::SlotDefinition, @ins.next.receiver.class
|
|
|
|
end
|
|
|
|
def test_receiver
|
|
|
|
assert_equal Parfait::Class, @ins.next.receiver.known_object.class
|
|
|
|
end
|
|
|
|
def test_call_is
|
|
|
|
assert_equal Mom::SimpleCall, @ins.next(2).class
|
|
|
|
end
|
|
|
|
def test_call_has_method
|
|
|
|
assert_equal Parfait::CallableMethod, @ins.next(2).method.class
|
|
|
|
end
|
|
|
|
def test_array
|
2019-08-12 10:57:32 +02:00
|
|
|
check_array [MessageSetup,ArgumentTransfer,SimpleCall,Label,
|
|
|
|
ReturnSequence , Label] , @ins
|
2019-02-23 17:17:26 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|