start to compile send
still very hacked version of simple call, but a start
This commit is contained in:
@ -34,4 +34,17 @@ module Vool
|
||||
assert_equal IntegerStatement , @stats.first.right.class
|
||||
end
|
||||
end
|
||||
class TestReturnSendMom < MiniTest::Test
|
||||
include MomCompile
|
||||
|
||||
def setup
|
||||
Risc.machine.boot
|
||||
@stats = compile_first_method( "return foo").first
|
||||
end
|
||||
|
||||
def test_two_instructions_are_returned
|
||||
#need to implement send first
|
||||
# assert_equal 2 , @stats.length
|
||||
end
|
||||
end
|
||||
end
|
||||
|
37
test/vool/to_mom/test_send.rb
Normal file
37
test/vool/to_mom/test_send.rb
Normal file
@ -0,0 +1,37 @@
|
||||
require_relative "helper"
|
||||
|
||||
module Vool
|
||||
class TestSendMom < MiniTest::Test
|
||||
include MomCompile
|
||||
|
||||
def setup
|
||||
Risc.machine.boot
|
||||
@stats = compile_first_method( "5.mod4").first
|
||||
end
|
||||
|
||||
def test_class_compiles
|
||||
assert_equal Mom::SlotConstant , @stats.first.class , @stats
|
||||
end
|
||||
def test_slot_is_set
|
||||
assert @stats.first.left
|
||||
end
|
||||
def test_two_instructions_are_returned
|
||||
assert_equal 2 , @stats.length
|
||||
end
|
||||
def test_receiver_class
|
||||
assert_equal Mom::SlotConstant, @stats.first.class
|
||||
end
|
||||
def test_receiver_move
|
||||
assert_equal :receiver, @stats.first.left[2]
|
||||
end
|
||||
def test_call_is
|
||||
assert_equal Mom::SimpleCall, @stats[1].class
|
||||
end
|
||||
def test_call_has_method
|
||||
assert_equal Parfait::TypedMethod, @stats[1].method.class
|
||||
end
|
||||
def test_call_has_right_method
|
||||
assert_equal :mod4, @stats[1].method.name
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user