fix all the test data to be yaml

This commit is contained in:
Torsten Ruger 2014-07-18 00:30:47 +03:00
parent 2e79caa791
commit 23e1b2519e
2 changed files with 16 additions and 16 deletions

View File

@ -5,53 +5,53 @@ class TestBasic < MiniTest::Test
def test_number
@string_input = '42 '
@output = [Virtual::IntegerConstant.new(42)]
@output = "---_MY_MY_MARKER- !ruby/object:Virtual::IntegerConstant_MY_MY_MARKER integer: 42_MY_MY_MARKER"
check
end
def test_true
@string_input = 'true '
@output = [Virtual::TrueValue.new()]
@output = "---_MY_MY_MARKER- !ruby/object:Virtual::TrueValue {}_MY_MY_MARKER"
check
end
def test_false
@string_input = 'false '
@output = [Virtual::FalseValue.new()]
@output = "---_MY_MY_MARKER- !ruby/object:Virtual::FalseValue {}_MY_MY_MARKER"
check
end
def test_nil
@string_input = 'nil '
@output = [Virtual::NilValue.new()]
@output = "---_MY_MY_MARKER- !ruby/object:Virtual::NilValue {}_MY_MY_MARKER"
check
end
def test_name
@string_input = 'foo '
@output = [Virtual::Return.new(Virtual::Mystery)]
@output = "---_MY_MY_MARKER- !ruby/object:Virtual::Return_MY_MY_MARKER name: :return_MY_MY_MARKER type: !ruby/class 'Virtual::Mystery'_MY_MY_MARKER"
check
end
def test_self
@string_input = 'self '
@output = [Virtual::Self.new(Virtual::Mystery.new())]
@output = "---_MY_MY_MARKER- !ruby/object:Virtual::Self_MY_MY_MARKER name: :self_MY_MY_MARKER type: !ruby/object:Virtual::Mystery {}_MY_MY_MARKER"
check
end
def test_instance_variable
@string_input = '@foo_bar '
@output = [Virtual::Return.new( Virtual::Mystery.new())]
@output = "---_MY_MY_MARKER- !ruby/object:Virtual::Return_MY_MY_MARKER name: :return_MY_MY_MARKER type: !ruby/object:Virtual::Mystery {}_MY_MY_MARKER"
check
end
def test_module_name
@string_input = 'FooBar '
@output = [Boot::BootClass.new(:FooBar,:Object)]
@output = "---_MY_MY_MARKER- &1 !ruby/object:Boot::BootClass_MY_MY_MARKER method_definitions: []_MY_MY_MARKER name: :FooBar_MY_MY_MARKER super_class_name: :Object_MY_MY_MARKER meta_class: !ruby/object:Boot::MetaClass_MY_MY_MARKER layout: !ruby/object:Virtual::Layout_MY_MY_MARKER members: []_MY_MY_MARKER functions: []_MY_MY_MARKER me_self: *1_MY_MY_MARKER"
check
end
def test_string
@string_input = "\"hello\""
@output = [Virtual::StringConstant.new('hello')]
@output = "---_MY_MY_MARKER- !ruby/object:Virtual::StringConstant_MY_MY_MARKER string: hello_MY_MY_MARKER"
check
end

View File

@ -9,7 +9,7 @@ def foo(x)
5
end
HERE
@output = [Virtual::MethodDefinition.new(:foo,[Virtual::Argument.new(:x,Virtual::Mystery.new())],Virtual::SelfReference.new(nil),Virtual::IntegerConstant.new(5),Virtual::MethodEnter.new(nil))]
@output = "---_MY_MY_MARKER- !ruby/object:Virtual::MethodDefinition_MY_MY_MARKER name: :foo_MY_MY_MARKER args:_MY_MY_MARKER - !ruby/object:Virtual::Argument_MY_MY_MARKER name: :x_MY_MY_MARKER type: !ruby/object:Virtual::Mystery {}_MY_MY_MARKER locals: []_MY_MY_MARKER tmps: []_MY_MY_MARKER receiver: !ruby/object:Virtual::SelfReference_MY_MY_MARKER clazz: _MY_MY_MARKER return_type: !ruby/object:Virtual::IntegerConstant_MY_MY_MARKER integer: 5_MY_MY_MARKER start: &1 !ruby/object:Virtual::MethodEnter_MY_MY_MARKER next: _MY_MY_MARKER current: *1_MY_MY_MARKER"
check
end
@ -19,7 +19,7 @@ def String.length(x)
@length
end
HERE
@output = [Virtual::MethodDefinition.new(:length,[Virtual::Argument.new(:x,Virtual::Mystery.new())],Boot::BootClass.new(:String,:Object),Virtual::Return.new(Virtual::Mystery.new()),Virtual::MethodEnter.new(Virtual::ObjectGet.new(:length,nil)))]
@output = "---_MY_MY_MARKER- !ruby/object:Virtual::MethodDefinition_MY_MY_MARKER name: :length_MY_MY_MARKER args:_MY_MY_MARKER - !ruby/object:Virtual::Argument_MY_MY_MARKER name: :x_MY_MY_MARKER type: !ruby/object:Virtual::Mystery {}_MY_MY_MARKER locals: []_MY_MY_MARKER tmps: []_MY_MY_MARKER receiver: &4 !ruby/object:Boot::BootClass_MY_MY_MARKER method_definitions:_MY_MY_MARKER - !ruby/object:Virtual::MethodDefinition_MY_MY_MARKER name: :get_MY_MY_MARKER args:_MY_MY_MARKER - &1 !ruby/class 'Virtual::Integer'_MY_MY_MARKER locals: []_MY_MY_MARKER tmps: []_MY_MY_MARKER receiver: *1_MY_MY_MARKER return_type: *1_MY_MY_MARKER start: &2 !ruby/object:Virtual::MethodEnter_MY_MY_MARKER next: _MY_MY_MARKER current: *2_MY_MY_MARKER - !ruby/object:Virtual::MethodDefinition_MY_MY_MARKER name: :set_MY_MY_MARKER args:_MY_MY_MARKER - *1_MY_MY_MARKER - *1_MY_MY_MARKER locals: []_MY_MY_MARKER tmps: []_MY_MY_MARKER receiver: *1_MY_MY_MARKER return_type: *1_MY_MY_MARKER start: &3 !ruby/object:Virtual::MethodEnter_MY_MY_MARKER next: _MY_MY_MARKER current: *3_MY_MY_MARKER name: :String_MY_MY_MARKER super_class_name: :Object_MY_MY_MARKER meta_class: !ruby/object:Boot::MetaClass_MY_MY_MARKER layout: !ruby/object:Virtual::Layout_MY_MY_MARKER members: []_MY_MY_MARKER functions: []_MY_MY_MARKER me_self: *4_MY_MY_MARKER return_type: !ruby/object:Virtual::Return_MY_MY_MARKER name: :return_MY_MY_MARKER type: !ruby/object:Virtual::Mystery {}_MY_MY_MARKER start: !ruby/object:Virtual::MethodEnter_MY_MY_MARKER next: &5 !ruby/object:Virtual::ObjectGet_MY_MY_MARKER next: _MY_MY_MARKER name: :length_MY_MY_MARKER current: *5_MY_MY_MARKER"
check
end
@ -30,7 +30,7 @@ def foo(x)
2 + 5
end
HERE
@output = [Virtual::MethodDefinition.new(:foo,[Virtual::Argument.new(:x,Virtual::Mystery.new())],Virtual::SelfReference.new(nil),Virtual::Return.new(Virtual::Mystery),Virtual::MethodEnter.new(Virtual::FrameSet.new(:abba,Virtual::IntegerConstant.new(5),Virtual::LoadSelf.new(Virtual::IntegerConstant.new(2),Virtual::FrameSend.new(:+,[Virtual::IntegerConstant.new(5)],nil)))))]
@output ="---_MY_MY_MARKER- !ruby/object:Virtual::MethodDefinition_MY_MY_MARKER name: :foo_MY_MY_MARKER args:_MY_MY_MARKER - !ruby/object:Virtual::Argument_MY_MY_MARKER name: :x_MY_MY_MARKER type: !ruby/object:Virtual::Mystery {}_MY_MY_MARKER locals:_MY_MY_MARKER - !ruby/object:Virtual::Local_MY_MY_MARKER name: :abba_MY_MY_MARKER type: &1 !ruby/object:Virtual::IntegerConstant_MY_MY_MARKER integer: 5_MY_MY_MARKER tmps: []_MY_MY_MARKER receiver: !ruby/object:Virtual::SelfReference_MY_MY_MARKER clazz: _MY_MY_MARKER return_type: !ruby/object:Virtual::Return_MY_MY_MARKER name: :return_MY_MY_MARKER type: !ruby/class 'Virtual::Mystery'_MY_MY_MARKER start: !ruby/object:Virtual::MethodEnter_MY_MY_MARKER next: !ruby/object:Virtual::FrameSet_MY_MY_MARKER next: !ruby/object:Virtual::LoadSelf_MY_MY_MARKER next: &2 !ruby/object:Virtual::FrameSend_MY_MY_MARKER next: _MY_MY_MARKER name: :+_MY_MY_MARKER args:_MY_MY_MARKER - !ruby/object:Virtual::IntegerConstant_MY_MY_MARKER integer: 5_MY_MY_MARKER value: !ruby/object:Virtual::IntegerConstant_MY_MY_MARKER integer: 2_MY_MY_MARKER name: :abba_MY_MY_MARKER value: *1_MY_MY_MARKER current: *2_MY_MY_MARKER"
check
end
@ -40,7 +40,7 @@ def foo()
2 + 5
end
HERE
@output = [Virtual::MethodDefinition.new(:foo,[],Virtual::SelfReference.new(nil),Virtual::Return.new(Virtual::Mystery),Virtual::MethodEnter.new(Virtual::LoadSelf.new(Virtual::IntegerConstant.new(2),Virtual::FrameSend.new(:+,[Virtual::IntegerConstant.new(5)],nil))))]
@output = "---_MY_MY_MARKER- !ruby/object:Virtual::MethodDefinition_MY_MY_MARKER name: :foo_MY_MY_MARKER args: []_MY_MY_MARKER locals: []_MY_MY_MARKER tmps: []_MY_MY_MARKER receiver: !ruby/object:Virtual::SelfReference_MY_MY_MARKER clazz: _MY_MY_MARKER return_type: !ruby/object:Virtual::Return_MY_MY_MARKER name: :return_MY_MY_MARKER type: !ruby/class 'Virtual::Mystery'_MY_MY_MARKER start: !ruby/object:Virtual::MethodEnter_MY_MY_MARKER next: !ruby/object:Virtual::LoadSelf_MY_MY_MARKER next: &1 !ruby/object:Virtual::FrameSend_MY_MY_MARKER next: _MY_MY_MARKER name: :+_MY_MY_MARKER args:_MY_MY_MARKER - !ruby/object:Virtual::IntegerConstant_MY_MY_MARKER integer: 5_MY_MY_MARKER value: !ruby/object:Virtual::IntegerConstant_MY_MY_MARKER integer: 2_MY_MY_MARKER current: *1_MY_MY_MARKER"
check
end
@ -54,7 +54,7 @@ def ofthen(n)
end
end
HERE
@output = [Virtual::MethodDefinition.new(:ofthen,[Virtual::Argument.new(:n,Virtual::Mystery.new())],Virtual::SelfReference.new(nil),Virtual::Local.new(:maybenot,Virtual::IntegerConstant.new(667)),Virtual::MethodEnter.new(Virtual::ImplicitBranch.new(:if_merge_1,Virtual::FrameSet.new(:isit,Virtual::IntegerConstant.new(42),Virtual::Label.new(:if_merge_1,nil)),Virtual::FrameSet.new(:maybenot,Virtual::IntegerConstant.new(667),Virtual::Label.new(:if_merge_1,nil)))))]
@output = "---_MY_MY_MARKER- !ruby/object:Virtual::MethodDefinition_MY_MY_MARKER name: :ofthen_MY_MY_MARKER args:_MY_MY_MARKER - !ruby/object:Virtual::Argument_MY_MY_MARKER name: :n_MY_MY_MARKER type: !ruby/object:Virtual::Mystery {}_MY_MY_MARKER locals:_MY_MY_MARKER - !ruby/object:Virtual::Local_MY_MY_MARKER name: :isit_MY_MY_MARKER type: &2 !ruby/object:Virtual::IntegerConstant_MY_MY_MARKER integer: 42_MY_MY_MARKER - &1 !ruby/object:Virtual::Local_MY_MY_MARKER name: :maybenot_MY_MY_MARKER type: &4 !ruby/object:Virtual::IntegerConstant_MY_MY_MARKER integer: 667_MY_MY_MARKER tmps: []_MY_MY_MARKER receiver: !ruby/object:Virtual::SelfReference_MY_MY_MARKER clazz: _MY_MY_MARKER return_type: *1_MY_MY_MARKER start: !ruby/object:Virtual::MethodEnter_MY_MY_MARKER next: !ruby/object:Virtual::ImplicitBranch_MY_MY_MARKER next: !ruby/object:Virtual::FrameSet_MY_MY_MARKER next: &3 !ruby/object:Virtual::Label_MY_MY_MARKER next: _MY_MY_MARKER name: :if_merge_1_MY_MY_MARKER name: :isit_MY_MY_MARKER value: *2_MY_MY_MARKER name: :if_merge_1_MY_MY_MARKER other: !ruby/object:Virtual::FrameSet_MY_MY_MARKER next: *3_MY_MY_MARKER name: :maybenot_MY_MY_MARKER value: *4_MY_MY_MARKER current: *3_MY_MY_MARKER"
check
end
@ -68,7 +68,7 @@ def fibonaccit(n)
end
end
HERE
@output = [Virtual::MethodDefinition.new(:ofthen,[Virtual::Argument.new(:n,Virtual::Mystery.new())],Virtual::SelfReference.new(nil),Virtual::Local.new(:maybenot,Virtual::IntegerConstant.new(667)),Virtual::MethodEnter.new(Virtual::ImplicitBranch.new(:if_merge_2,Virtual::FrameSet.new(:isit,Virtual::IntegerConstant.new(42),Virtual::Label.new(:if_merge_2,nil)),Virtual::FrameSet.new(:maybenot,Virtual::IntegerConstant.new(667),Virtual::Label.new(:if_merge_2,nil)))))]
@output = "---_MY_MY_MARKER- !ruby/object:Virtual::MethodDefinition_MY_MY_MARKER name: :fibonaccit_MY_MY_MARKER args:_MY_MY_MARKER - !ruby/object:Virtual::Argument_MY_MY_MARKER name: :n_MY_MY_MARKER type: !ruby/object:Virtual::Mystery {}_MY_MY_MARKER locals:_MY_MY_MARKER - !ruby/object:Virtual::Local_MY_MY_MARKER name: :a_MY_MY_MARKER type: &6 !ruby/object:Virtual::IntegerConstant_MY_MY_MARKER integer: 0_MY_MY_MARKER - &4 !ruby/object:Virtual::Local_MY_MY_MARKER name: :some_MY_MY_MARKER type: &5 !ruby/object:Virtual::IntegerConstant_MY_MY_MARKER integer: 43_MY_MY_MARKER - &1 !ruby/object:Virtual::Local_MY_MY_MARKER name: :other_MY_MY_MARKER type: &3 !ruby/object:Virtual::Return_MY_MY_MARKER name: :return_MY_MY_MARKER type: !ruby/class 'Virtual::Mystery'_MY_MY_MARKER tmps: []_MY_MY_MARKER receiver: !ruby/object:Virtual::SelfReference_MY_MY_MARKER clazz: _MY_MY_MARKER return_type: *1_MY_MY_MARKER start: !ruby/object:Virtual::MethodEnter_MY_MY_MARKER next: !ruby/object:Virtual::FrameSet_MY_MY_MARKER next: &2 !ruby/object:Virtual::Label_MY_MY_MARKER next: !ruby/object:Virtual::FrameGet_MY_MY_MARKER next: !ruby/object:Virtual::ImplicitBranch_MY_MY_MARKER next: !ruby/object:Virtual::FrameSet_MY_MY_MARKER next: !ruby/object:Virtual::FrameGet_MY_MY_MARKER next: !ruby/object:Virtual::LoadSelf_MY_MY_MARKER next: !ruby/object:Virtual::FrameSend_MY_MY_MARKER next: !ruby/object:Virtual::FrameSet_MY_MY_MARKER next: *2_MY_MY_MARKER name: :other_MY_MY_MARKER value: *3_MY_MY_MARKER name: :*_MY_MY_MARKER args:_MY_MY_MARKER - !ruby/object:Virtual::IntegerConstant_MY_MY_MARKER integer: 4_MY_MY_MARKER value: *4_MY_MY_MARKER name: :some_MY_MY_MARKER name: :some_MY_MY_MARKER value: *5_MY_MY_MARKER name: :while_1_MY_MY_MARKER other: &7 !ruby/object:Virtual::Label_MY_MY_MARKER next: _MY_MY_MARKER name: :while_1_MY_MY_MARKER name: :n_MY_MY_MARKER name: while_start_MY_MY_MARKER name: :a_MY_MY_MARKER value: *6_MY_MY_MARKER current: *7_MY_MY_MARKER"
check
end
@ -79,7 +79,7 @@ def retvar(n)
return i
end
HERE
@output = [Virtual::MethodDefinition.new(:retvar,[Virtual::Argument.new(:n,Virtual::Mystery.new())],Virtual::SelfReference.new(nil),Virtual::Reference.new(nil),Virtual::MethodEnter.new(Virtual::FrameSet.new(:i,Virtual::IntegerConstant.new(5),nil)))]
@output = "---_MY_MY_MARKER- !ruby/object:Virtual::MethodDefinition_MY_MY_MARKER name: :retvar_MY_MY_MARKER args:_MY_MY_MARKER - !ruby/object:Virtual::Argument_MY_MY_MARKER name: :n_MY_MY_MARKER type: !ruby/object:Virtual::Mystery {}_MY_MY_MARKER locals:_MY_MY_MARKER - !ruby/object:Virtual::Local_MY_MY_MARKER name: :i_MY_MY_MARKER type: &1 !ruby/object:Virtual::IntegerConstant_MY_MY_MARKER integer: 5_MY_MY_MARKER tmps: []_MY_MY_MARKER receiver: !ruby/object:Virtual::SelfReference_MY_MY_MARKER clazz: _MY_MY_MARKER return_type: !ruby/object:Virtual::Reference_MY_MY_MARKER clazz: _MY_MY_MARKER start: !ruby/object:Virtual::MethodEnter_MY_MY_MARKER next: &2 !ruby/object:Virtual::FrameSet_MY_MY_MARKER next: _MY_MY_MARKER name: :i_MY_MY_MARKER value: *1_MY_MY_MARKER current: *2_MY_MY_MARKER"
check
end