new tests for space

finds the bug in message creation!
This commit is contained in:
Torsten Ruger
2015-07-02 11:09:23 +03:00
parent 185f4b4697
commit caa4ae1cf0
5 changed files with 42 additions and 5 deletions

View File

@ -2,3 +2,4 @@ require_relative "test_object"
require_relative "test_list"
require_relative "test_word"
require_relative "test_dictionary"
require_relative "test_space"

View File

@ -0,0 +1,36 @@
require_relative "../helper"
class TestSpace < MiniTest::Test
def setup
@machine = Virtual.machine
@machine.boot
end
def test_booted
assert_equal true , @machine.booted
end
def test_machine_space
assert_equal Parfait::Space , @machine.space.class
end
def test_gloabl_space
assert_equal Parfait::Space , Parfait::Space.object_space.class
end
def test_classes
assert_equal 16 , @machine.space.classes.length
[:Kernel,:Word,:List,:Message,:Frame,:Layout,:Class,:Dictionary,:Method].each do |name|
assert @machine.space.classes[name]
end
end
def test_messages
mess = @machine.space.first_message
all = []
while mess
all << mess
assert mess.frame
mess = mess.next_message
end
assert_equal all.length , all.uniq.length
# there is a 5.times in space, but one Message gets created before
assert_equal 5 + 1 , all.length
end
end

View File

@ -30,7 +30,7 @@ module VirtualHelper
expressions.first.type.instance_variable_set :@of_class , nil
end
is = Sof.write(expressions)
puts is
#puts is
is.gsub!("\n" , "*^*")
assert_equal @output , is
end