Fix all but one test
Riples upon riples. The one left looks like the genuine article
This commit is contained in:
@ -11,18 +11,18 @@ module VoolBlocks
|
||||
end
|
||||
|
||||
def test_condition
|
||||
assert_equal TruthCheck , @ins.next(4).class
|
||||
assert_equal TruthCheck , @ins.next(3).class
|
||||
end
|
||||
def test_condition_is_slot
|
||||
assert_equal SlotDefinition , @ins.next(4).condition.class , @ins
|
||||
assert_equal SlotDefinition , @ins.next(3).condition.class , @ins
|
||||
end
|
||||
def test_hoisted_dynamic_call
|
||||
def test_simple_call
|
||||
assert_equal SimpleCall , @ins.next(2).class
|
||||
assert_equal :div4 , @ins.next(2).method.name
|
||||
end
|
||||
def test_array
|
||||
check_array [MessageSetup, ArgumentTransfer, SimpleCall, SlotLoad, TruthCheck, Label ,
|
||||
SlotLoad, Jump, Label, SlotLoad, Label,
|
||||
check_array [MessageSetup, ArgumentTransfer, SimpleCall, TruthCheck, Label ,
|
||||
SlotLoad, Jump, Label, SlotLoad, Label ,
|
||||
Label, ReturnSequence, Label] , @ins
|
||||
end
|
||||
|
||||
|
@ -5,12 +5,11 @@ module Vool
|
||||
include VoolCompile
|
||||
|
||||
def setup
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@compiler = compile_first_method( "a = 5; a.div4")
|
||||
@ins = @compiler.mom_instructions.next
|
||||
end
|
||||
def test_check_type
|
||||
assert_equal NotSameCheck , @ins.next.class , @ins
|
||||
assert_equal NotSameCheck , @ins.next(1).class , @ins
|
||||
end
|
||||
def test_type_update
|
||||
load = @ins.next(2)
|
||||
@ -27,9 +26,9 @@ module Vool
|
||||
end
|
||||
|
||||
def test_array
|
||||
check_array [SlotLoad, NotSameCheck, SlotLoad, ResolveMethod, Label, MessageSetup ,
|
||||
ArgumentTransfer, DynamicCall, Label, ReturnSequence ,
|
||||
Label] , @ins
|
||||
check_array [SlotLoad, NotSameCheck, SlotLoad, ResolveMethod ,
|
||||
Label, MessageSetup, ArgumentTransfer, DynamicCall, Label ,
|
||||
ReturnSequence, Label] , @ins
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -48,11 +48,11 @@ module Vool
|
||||
end
|
||||
|
||||
def test_return_is_last
|
||||
assert_equal ReturnJump , @ins.next(5).class
|
||||
assert_equal ReturnJump , @ins.next(4).class
|
||||
end
|
||||
def test_array
|
||||
check_array [MessageSetup,ArgumentTransfer,SimpleCall,SlotLoad,
|
||||
SlotLoad,ReturnJump, Label, ReturnSequence, Label] , @ins
|
||||
check_array [MessageSetup, ArgumentTransfer, SimpleCall, SlotLoad, ReturnJump ,
|
||||
Label, ReturnSequence, Label] , @ins
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,11 +1,32 @@
|
||||
require_relative "helper"
|
||||
|
||||
module Vool
|
||||
module YieldBasics
|
||||
include Mom
|
||||
class TestYieldArgsSendMom < MiniTest::Test
|
||||
include VoolCompile
|
||||
|
||||
def setup
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@compiler = compile_first_method( "return yield(1)" )
|
||||
@ins = @compiler.mom_instructions.next
|
||||
end
|
||||
|
||||
def test_array
|
||||
check_array [NotSameCheck, Label, MessageSetup, ArgumentTransfer, BlockYield ,
|
||||
SlotLoad, ReturnJump, Label, ReturnSequence , Label] , @ins
|
||||
end
|
||||
def test_check_label
|
||||
assert_equal NotSameCheck, @ins.class
|
||||
assert @ins.false_jump.name.start_with?("method_ok_")
|
||||
assert @ins.false_jump.name.start_with?("method_ok_") , @ins.false_jump.name
|
||||
end
|
||||
def test_transfer
|
||||
assert_equal ArgumentTransfer, @ins.next(3).class
|
||||
assert_equal 1, @ins.next(3).arguments.length
|
||||
end
|
||||
def test_args_one_l
|
||||
left = @ins.next(3).arguments[0].left
|
||||
assert_equal Symbol, left.known_object.class
|
||||
assert_equal :message, left.known_object
|
||||
assert_equal [:next_message, :arguments, 1], left.slots
|
||||
end
|
||||
def test_check_left
|
||||
assert_equal SlotDefinition, @ins.left.class
|
||||
@ -38,64 +59,37 @@ module Vool
|
||||
assert_equal SlotLoad, @ins.next(5).class
|
||||
assert_equal :message, @ins.next(5).left.known_object
|
||||
assert_equal :message, @ins.next(5).right.known_object
|
||||
assert_equal :frame, @ins.next(5).left.slots.first
|
||||
assert @ins.next(5).left.slots.last.to_s.start_with?("tmp_")
|
||||
assert_equal [:return_value], @ins.next(5).left.slots
|
||||
assert_equal [:return_value], @ins.next(5).right.slots
|
||||
end
|
||||
def test_return_load2
|
||||
assert_equal SlotLoad, @ins.next(6).class
|
||||
assert_equal :message, @ins.next(6).left.known_object
|
||||
assert_equal :message, @ins.next(6).right.known_object
|
||||
assert_equal :return_value, @ins.next(6).left.slots.first
|
||||
assert_equal :frame, @ins.next(6).right.slots.first
|
||||
assert @ins.next(6).right.slots.last.to_s.start_with?("tmp_")
|
||||
end
|
||||
def test_return
|
||||
assert_equal ReturnJump, @ins.next(7).class
|
||||
end
|
||||
end
|
||||
class TestYieldArgsSendMom < MiniTest::Test
|
||||
include VoolCompile
|
||||
include YieldBasics
|
||||
|
||||
def setup
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@compiler = compile_first_method( "return yield(1)" )
|
||||
@ins = @compiler.mom_instructions.next
|
||||
end
|
||||
|
||||
def test_array
|
||||
check_array [NotSameCheck, Label, MessageSetup, ArgumentTransfer, BlockYield ,
|
||||
SlotLoad, SlotLoad, ReturnJump, Label, ReturnSequence ,
|
||||
Label] , @ins
|
||||
end
|
||||
def test_transfer
|
||||
assert_equal ArgumentTransfer, @ins.next(3).class
|
||||
assert_equal 1, @ins.next(3).arguments.length
|
||||
end
|
||||
def test_args_one_l
|
||||
left = @ins.next(3).arguments[0].left
|
||||
assert_equal Symbol, left.known_object.class
|
||||
assert_equal :message, left.known_object
|
||||
assert_equal [:next_message, :arguments, 1], left.slots
|
||||
assert_equal ReturnJump, @ins.next(6).class
|
||||
end
|
||||
end
|
||||
class TestYieldNoArgsSendMom < MiniTest::Test
|
||||
include VoolCompile
|
||||
include YieldBasics
|
||||
|
||||
def setup
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@compiler = compile_first_method( "return yield" )
|
||||
@compiler = compile_first_method( "return yield(some.extra.calls)" )
|
||||
@ins = @compiler.mom_instructions.next
|
||||
end
|
||||
def test_check_label
|
||||
assert_equal NotSameCheck, @ins.class
|
||||
assert @ins.false_jump.name.start_with?("cache_ok_") , @ins.false_jump.name
|
||||
end
|
||||
def test_array
|
||||
check_array [NotSameCheck, Label, MessageSetup, ArgumentTransfer, BlockYield ,
|
||||
SlotLoad, SlotLoad, ReturnJump, Label, ReturnSequence ,
|
||||
Label] , @ins
|
||||
check_array [NotSameCheck, SlotLoad, ResolveMethod, Label, MessageSetup ,
|
||||
ArgumentTransfer, DynamicCall, SlotLoad, NotSameCheck, SlotLoad ,
|
||||
ResolveMethod, Label, MessageSetup, ArgumentTransfer, DynamicCall ,
|
||||
SlotLoad, NotSameCheck, SlotLoad, ResolveMethod, Label ,
|
||||
MessageSetup, ArgumentTransfer, DynamicCall, SlotLoad, NotSameCheck ,
|
||||
Label, MessageSetup, ArgumentTransfer, BlockYield, SlotLoad ,
|
||||
ReturnJump, Label, ReturnSequence, Label] , @ins
|
||||
end
|
||||
def test_transfer
|
||||
assert_equal ArgumentTransfer, @ins.next(3).class
|
||||
assert_equal 0, @ins.next(3).arguments.length
|
||||
assert_equal ArgumentTransfer, @ins.next(5).class
|
||||
assert_equal 0, @ins.next(5).arguments.length
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user