rubyx/test/vool/to_mom/send/test_send_self.rb

42 lines
956 B
Ruby
Raw Normal View History

require_relative "../helper"
2017-09-11 20:30:28 +02:00
require_relative "simple_send_harness"
module Vool
class TestSendSelfMom < MiniTest::Test
include MomCompile
2017-09-11 20:30:28 +02:00
include SimpleSendHarness
2018-03-16 14:11:17 +01:00
include Mom
2017-09-11 13:23:30 +02:00
def do_setup(str)
Risc.machine.boot
2018-03-16 14:11:17 +01:00
@ins = compile_first_method( str)
2017-09-11 13:23:30 +02:00
end
def setup
do_setup("self.get_internal_word(0)")
end
2017-09-11 20:30:28 +02:00
def test_receiver
2018-03-16 14:11:17 +01:00
assert_equal SlotDefinition, @ins.next.right.class
end
2017-09-11 20:30:28 +02:00
def test_arg_one
2018-03-16 14:11:17 +01:00
assert_equal SlotLoad, @ins.next(2).arguments[0].class
end
def test_call_two
2018-03-16 14:11:17 +01:00
assert_equal SimpleCall, @ins.next(3).class
end
def test_call_has_method
2018-03-16 14:11:17 +01:00
assert_equal Parfait::TypedMethod, @ins.next(3).method.class
end
def test_call_has_right_method
2018-03-16 14:11:17 +01:00
assert_equal :get_internal_word, @ins.next(3).method.name
end
end
class TestSendSelfImplicitMom < TestSendSelfMom
def setup
2017-09-11 13:23:30 +02:00
do_setup( "get_internal_word(0)")
end
end
end