rubyx/test/vool/test_class_expression2.rb
Torsten Rüger dd810cfc49 Make to_mom a 2 stage process
First baby baby step on the way to passes
Create all parfait objects in first pass, so methods exist to be resolved in second path
2019-09-24 15:44:33 +03:00

36 lines
997 B
Ruby

require_relative "helper"
module Vool
class TestClassStatementCompile < MiniTest::Test
include VoolCompile
def setup
@compiler = compile_main( "if(@a) ; @a = 5 ; else; @a = 6 ; end; return")
@ins = @compiler.mom_instructions
end
def test_label
assert_equal Label , @ins.class , @ins
assert_equal "Space_Type.main" , @ins.name , @ins
end
def test_condition_compiles_to_check
assert_equal TruthCheck , @ins.next.class , @ins
end
def test_condition_is_slot
assert_equal SlotDefinition , @ins.next.condition.class , @ins
end
def test_label_after_check
assert_equal Label , @ins.next(2).class , @ins
end
def test_label_last
assert_equal Label , @ins.last.class , @ins
end
def test_array
check_array [Label, TruthCheck, Label, SlotLoad, Jump ,
Label, SlotLoad, Label, SlotLoad, ReturnJump ,
Label, ReturnSequence, Label] , @ins
end
end
end