remove the space instance from register machine
bad design, probably from the booting
This commit is contained in:
@ -3,7 +3,9 @@ require_relative "../helper"
|
||||
class TestAttributes < MiniTest::Test
|
||||
|
||||
def setup
|
||||
@mess = Register.machine.boot.space.first_message
|
||||
Register.machine.boot
|
||||
@space = Parfait::Space.object_space
|
||||
@mess = @space.first_message
|
||||
@type = @mess.get_type
|
||||
end
|
||||
|
||||
|
@ -3,7 +3,8 @@ require_relative "../helper"
|
||||
class TestClass < MiniTest::Test
|
||||
|
||||
def setup
|
||||
@space = Register.machine.boot.space
|
||||
Register.machine.boot
|
||||
@space = Parfait::Space.object_space
|
||||
@try = @space.create_class :Try , :Object
|
||||
end
|
||||
|
||||
|
@ -10,10 +10,10 @@ class TestList < MiniTest::Test
|
||||
assert @list.is_a? Parfait::Indexed
|
||||
end
|
||||
def test_old_type
|
||||
assert_equal Parfait::Type , Register.machine.space.classes.keys.get_type.class
|
||||
assert_equal Parfait::Type , Parfait::Space.object_space.classes.keys.get_type.class
|
||||
end
|
||||
def test_old_type_push
|
||||
list = Register.machine.space.classes.keys
|
||||
list = Parfait::Space.object_space.classes.keys
|
||||
assert_equal Parfait::Type , list.get_type.class
|
||||
end
|
||||
def test_new_type
|
||||
@ -28,7 +28,7 @@ class TestList < MiniTest::Test
|
||||
assert_equal 1 , type.variable_index(:type)
|
||||
end
|
||||
def notest_type_is_first_old
|
||||
type = Register.machine.space.classes.keys.get_type
|
||||
type = Parfait::Space.object_space.classes.keys.get_type
|
||||
assert_equal 1 , type.variable_index(:type)
|
||||
end
|
||||
|
||||
|
@ -3,7 +3,9 @@ require_relative "../helper"
|
||||
class TestMessage < MiniTest::Test
|
||||
|
||||
def setup
|
||||
@mess = Register.machine.boot.space.first_message
|
||||
Register.machine.boot
|
||||
@space = Parfait::Space.object_space
|
||||
@mess = @space.first_message
|
||||
end
|
||||
|
||||
def test_length
|
||||
|
@ -3,7 +3,9 @@ require_relative "../helper"
|
||||
class TestNamedLists < MiniTest::Test
|
||||
|
||||
def setup
|
||||
@named_list = Register.machine.boot.space.first_message.locals
|
||||
Register.machine.boot
|
||||
@space = Parfait::Space.object_space
|
||||
@named_list = @space.first_message.locals
|
||||
@type = @named_list.get_type
|
||||
end
|
||||
|
||||
|
@ -4,6 +4,7 @@ class TestSpace < MiniTest::Test
|
||||
|
||||
def setup
|
||||
@machine = Register.machine.boot
|
||||
@space = Parfait::Space.object_space
|
||||
end
|
||||
def classes
|
||||
[:Kernel,:Word,:List,:Message,:NamedList,:Type,:Object,:Class,:Dictionary,:TypedMethod , :Integer]
|
||||
@ -11,9 +12,7 @@ class TestSpace < MiniTest::Test
|
||||
def test_booted
|
||||
assert_equal true , @machine.booted
|
||||
end
|
||||
def test_machine_space
|
||||
assert_equal Parfait::Space , @machine.space.class
|
||||
end
|
||||
|
||||
def test_global_space
|
||||
assert_equal Parfait::Space , Parfait::Space.object_space.class
|
||||
end
|
||||
@ -24,30 +23,36 @@ class TestSpace < MiniTest::Test
|
||||
|
||||
def test_classes_class
|
||||
classes.each do |name|
|
||||
assert_equal :Class , @machine.space.classes[name].get_class.name
|
||||
assert_equal Parfait::Class , @machine.space.classes[name].class
|
||||
assert_equal :Class , @space.classes[name].get_class.name
|
||||
assert_equal Parfait::Class , @space.classes[name].class
|
||||
end
|
||||
end
|
||||
|
||||
def test_types
|
||||
assert @machine.space.types.is_a? Parfait::Dictionary
|
||||
assert @space.types.is_a? Parfait::Dictionary
|
||||
end
|
||||
|
||||
def test_types_each
|
||||
@space.each_type do |type|
|
||||
assert type.is_a?(Parfait::Type)
|
||||
end
|
||||
end
|
||||
|
||||
def test_classes_type
|
||||
classes.each do |name|
|
||||
assert_equal Parfait::Type , @machine.space.classes[name].get_type.class
|
||||
assert_equal Parfait::Type , @space.classes[name].get_type.class
|
||||
end
|
||||
end
|
||||
|
||||
def test_classes_name
|
||||
classes.each do |name|
|
||||
assert_equal name , @machine.space.classes[name].name
|
||||
assert_equal name , @space.classes[name].name
|
||||
end
|
||||
end
|
||||
|
||||
def test_method_name
|
||||
classes.each do |name|
|
||||
cl = @machine.space.classes[name]
|
||||
cl = @space.classes[name]
|
||||
cl.method_names.each do |mname|
|
||||
method = cl.get_instance_method(mname)
|
||||
assert_equal mname , method.name
|
||||
@ -56,7 +61,7 @@ class TestSpace < MiniTest::Test
|
||||
end
|
||||
end
|
||||
def test_messages
|
||||
mess = @machine.space.first_message
|
||||
mess = @space.first_message
|
||||
all = []
|
||||
while mess
|
||||
all << mess
|
||||
@ -68,19 +73,19 @@ class TestSpace < MiniTest::Test
|
||||
assert_equal 50 + 1 , all.length
|
||||
end
|
||||
def test_message_vars
|
||||
mess = @machine.space.first_message
|
||||
mess = @space.first_message
|
||||
all = mess.get_instance_variables
|
||||
assert all
|
||||
assert all.include?(:next_message)
|
||||
end
|
||||
|
||||
def test_create_class
|
||||
assert @machine.space.create_class( :NewClass )
|
||||
assert @space.create_class( :NewClass )
|
||||
end
|
||||
|
||||
def test_created_class_is_stored
|
||||
@machine.space.create_class( :NewerClass )
|
||||
assert @machine.space.get_class_by_name(:NewerClass)
|
||||
@space.create_class( :NewerClass )
|
||||
assert @space.get_class_by_name(:NewerClass)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -3,7 +3,7 @@ require_relative "../helper"
|
||||
class TestMethod < MiniTest::Test
|
||||
|
||||
def setup
|
||||
obj = Register.machine.space.get_class_by_name(:Object).instance_type
|
||||
obj = Parfait::Space.object_space.get_class_by_name(:Object).instance_type
|
||||
args = Parfait::Type.for_hash( obj.object_class , { bar: :Integer , foo: :Type})
|
||||
@method = ::Parfait::TypedMethod.new obj , :meth , args
|
||||
@method.add_local :local_bar , :Integer
|
||||
|
Reference in New Issue
Block a user