update parfait message according to boot
most of the attributes are not used at compile time , so they did not get updated. But the compiler uses the attribute names (which are correct as they are set in boot), so it’s nice to actually see them in ruby too.
This commit is contained in:
parent
c885888f4a
commit
21b436c476
@ -10,8 +10,14 @@
|
|||||||
module Parfait
|
module Parfait
|
||||||
class Message < Object
|
class Message < Object
|
||||||
|
|
||||||
attr_reader :locals , :receiver , :return_value , :name
|
# :next_message => :Message, :receiver => :Object, :locals => :NamedList ,
|
||||||
|
# :return_address => :Integer, :return_value => :Integer,
|
||||||
|
# :caller => :Message , :name => :Word , :arguments => :NamedList
|
||||||
|
|
||||||
attr_accessor :next_message
|
attr_accessor :next_message
|
||||||
|
attr_reader :receiver , :locals
|
||||||
|
attr_reader :return_address, :return_value
|
||||||
|
attr_reader :caller , :name , :arguments
|
||||||
|
|
||||||
def initialize next_m
|
def initialize next_m
|
||||||
@next_message = next_m
|
@next_message = next_m
|
||||||
|
@ -1,27 +1,43 @@
|
|||||||
require_relative "../helper"
|
require_relative "../helper"
|
||||||
|
|
||||||
class TestMessage < MiniTest::Test
|
module Parfait
|
||||||
|
class TestMessage < MiniTest::Test
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
Risc.machine.boot
|
Risc.machine.boot
|
||||||
@space = Parfait.object_space
|
@space = Parfait.object_space
|
||||||
@mess = @space.first_message
|
@mess = @space.first_message
|
||||||
end
|
end
|
||||||
|
def test_length
|
||||||
def test_length
|
assert_equal 9 , @mess.get_type.instance_length , @mess.get_type.inspect
|
||||||
assert_equal 9 , @mess.get_type.instance_length , @mess.get_type.inspect
|
end
|
||||||
end
|
def test_attribute_set
|
||||||
|
@mess.set_receiver( 55)
|
||||||
def test_attribute_set
|
assert_equal 55 , @mess.receiver
|
||||||
@mess.set_receiver( 55)
|
end
|
||||||
assert_equal 55 , @mess.receiver
|
def test_indexed
|
||||||
end
|
assert_equal 9 , @mess.get_type.variable_index(:arguments)
|
||||||
|
end
|
||||||
def test_indexed
|
def test_next_message
|
||||||
assert_equal 9 , @mess.get_type.variable_index(:arguments)
|
assert_equal Message , @mess.next_message.class
|
||||||
end
|
end
|
||||||
|
def test_locals
|
||||||
def test_next
|
assert_equal NamedList , @mess.locals.class
|
||||||
assert @mess.next_message
|
end
|
||||||
|
def test_arguments
|
||||||
|
assert_equal NamedList , @mess.arguments.class
|
||||||
|
end
|
||||||
|
def test_return_address
|
||||||
|
assert_nil @mess.return_address
|
||||||
|
end
|
||||||
|
def test_return_value
|
||||||
|
assert_nil @mess.return_value
|
||||||
|
end
|
||||||
|
def test_caller
|
||||||
|
assert_nil @mess.caller
|
||||||
|
end
|
||||||
|
def test_name
|
||||||
|
assert_nil @mess.name
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user