require_relative "virtual_helper" class TestMethods < MiniTest::Test include VirtualHelper def test_simplest_function @string_input = < 5) return 10 else return 20 end end HERE @output = "---RETURN_MARKER- !ruby/object:Virtual::MethodDefinitionRETURN_MARKER name: :retvarRETURN_MARKER args:RETURN_MARKER - &2 !ruby/object:Virtual::ArgumentRETURN_MARKER name: :nRETURN_MARKER type: !ruby/object:Virtual::Mystery {}RETURN_MARKER locals: []RETURN_MARKER tmps: []RETURN_MARKER receiver: !ruby/object:Virtual::SelfReferenceRETURN_MARKER clazz: RETURN_MARKER return_type: !ruby/object:Virtual::ReferenceRETURN_MARKER clazz: RETURN_MARKER start: !ruby/object:Virtual::MethodEnterRETURN_MARKER next: !ruby/object:Virtual::FrameGetRETURN_MARKER next: !ruby/object:Virtual::LoadSelfRETURN_MARKER next: !ruby/object:Virtual::FrameSendRETURN_MARKER next: !ruby/object:Virtual::ImplicitBranchRETURN_MARKER next: &1 !ruby/object:Virtual::LabelRETURN_MARKER next: RETURN_MARKER name: :if_merge_5246RETURN_MARKER name: :if_merge_5246RETURN_MARKER other: *1RETURN_MARKER name: :>RETURN_MARKER args:RETURN_MARKER - !ruby/object:Virtual::IntegerConstantRETURN_MARKER integer: 5RETURN_MARKER value: *2RETURN_MARKER name: :nRETURN_MARKER current: *1RETURN_MARKER" check end def test_function_return_while @string_input = < 5) do n = n + 1 return n end end HERE @output = "---RETURN_MARKER- !ruby/object:Virtual::MethodDefinitionRETURN_MARKER name: :retvarRETURN_MARKER args:RETURN_MARKER - !ruby/object:Virtual::ArgumentRETURN_MARKER name: :nRETURN_MARKER type: !ruby/object:Virtual::Mystery {}RETURN_MARKER locals: []RETURN_MARKER tmps: []RETURN_MARKER receiver: !ruby/object:Virtual::SelfReferenceRETURN_MARKER clazz: RETURN_MARKER return_type: !ruby/object:Virtual::ReferenceRETURN_MARKER clazz: RETURN_MARKER start: !ruby/object:Virtual::MethodEnterRETURN_MARKER next: !ruby/object:Virtual::LabelRETURN_MARKER name: while_startRETURN_MARKER next: !ruby/object:Virtual::MethodReturnRETURN_MARKER next: RETURN_MARKER current: !ruby/object:Virtual::LabelRETURN_MARKER name: :while_39010RETURN_MARKER next: RETURN_MARKER" check end def ttest_function_big_while @string_input = < 1 ) do tmp = a a = b b = tmp + b puts(b) n = n - 1 end end HERE @output = [Virtual::MethodDefinition.new(:foo,[Ast::NameExpression.new(:x)])] check end end