new tests for space
finds the bug in message creation!
This commit is contained in:
parent
185f4b4697
commit
caa4ae1cf0
@ -34,10 +34,10 @@ module Parfait
|
|||||||
def late_init
|
def late_init
|
||||||
message = Message.new(nil)
|
message = Message.new(nil)
|
||||||
5.times do
|
5.times do
|
||||||
new_message = Message.new message
|
|
||||||
message.set_caller new_message
|
|
||||||
end
|
|
||||||
@first_message = Message.new message
|
@first_message = Message.new message
|
||||||
|
message.set_caller @first_message
|
||||||
|
message = @first_message
|
||||||
|
end
|
||||||
init_layout
|
init_layout
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ module Virtual
|
|||||||
@objects = []
|
@objects = []
|
||||||
@booted = false
|
@booted = false
|
||||||
end
|
end
|
||||||
attr_reader :passes , :space , :class_mappings , :init , :objects
|
attr_reader :passes , :space , :class_mappings , :init , :objects , :booted
|
||||||
|
|
||||||
# run all passes before the pass given
|
# run all passes before the pass given
|
||||||
# also collect the block to run the passes on and
|
# also collect the block to run the passes on and
|
||||||
|
@ -2,3 +2,4 @@ require_relative "test_object"
|
|||||||
require_relative "test_list"
|
require_relative "test_list"
|
||||||
require_relative "test_word"
|
require_relative "test_word"
|
||||||
require_relative "test_dictionary"
|
require_relative "test_dictionary"
|
||||||
|
require_relative "test_space"
|
||||||
|
36
test/parfait/test_space.rb
Normal file
36
test/parfait/test_space.rb
Normal 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
|
@ -30,7 +30,7 @@ module VirtualHelper
|
|||||||
expressions.first.type.instance_variable_set :@of_class , nil
|
expressions.first.type.instance_variable_set :@of_class , nil
|
||||||
end
|
end
|
||||||
is = Sof.write(expressions)
|
is = Sof.write(expressions)
|
||||||
puts is
|
#puts is
|
||||||
is.gsub!("\n" , "*^*")
|
is.gsub!("\n" , "*^*")
|
||||||
assert_equal @output , is
|
assert_equal @output , is
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user