fixed the yaml output order for much better readability of failed tests
This commit is contained in:
parent
eb44011177
commit
a6e78ec837
@ -68,7 +68,7 @@ def fibonaccit(n)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
HERE
|
HERE
|
||||||
@output = "---RETURN_MARKER- !ruby/object:Virtual::MethodDefinitionRETURN_MARKER name: :fibonaccitRETURN_MARKER args:RETURN_MARKER - !ruby/object:Virtual::ArgumentRETURN_MARKER name: :nRETURN_MARKER type: !ruby/object:Virtual::Mystery {}RETURN_MARKER locals:RETURN_MARKER - !ruby/object:Virtual::LocalRETURN_MARKER name: :aRETURN_MARKER type: &6 !ruby/object:Virtual::IntegerConstantRETURN_MARKER integer: 0RETURN_MARKER - &4 !ruby/object:Virtual::LocalRETURN_MARKER name: :someRETURN_MARKER type: &5 !ruby/object:Virtual::IntegerConstantRETURN_MARKER integer: 43RETURN_MARKER - &1 !ruby/object:Virtual::LocalRETURN_MARKER name: :otherRETURN_MARKER type: &3 !ruby/object:Virtual::ReturnRETURN_MARKER name: :returnRETURN_MARKER type: !ruby/class 'Virtual::Mystery'RETURN_MARKER tmps: []RETURN_MARKER receiver: !ruby/object:Virtual::SelfReferenceRETURN_MARKER clazz: RETURN_MARKER return_type: *1RETURN_MARKER start: !ruby/object:Virtual::MethodEnterRETURN_MARKER next: !ruby/object:Virtual::FrameSetRETURN_MARKER next: &2 !ruby/object:Virtual::LabelRETURN_MARKER next: !ruby/object:Virtual::FrameGetRETURN_MARKER next: !ruby/object:Virtual::ImplicitBranchRETURN_MARKER next: !ruby/object:Virtual::FrameSetRETURN_MARKER next: !ruby/object:Virtual::FrameGetRETURN_MARKER next: !ruby/object:Virtual::LoadSelfRETURN_MARKER next: !ruby/object:Virtual::FrameSendRETURN_MARKER next: !ruby/object:Virtual::FrameSetRETURN_MARKER next: *2RETURN_MARKER name: :otherRETURN_MARKER value: *3RETURN_MARKER name: :*RETURN_MARKER args:RETURN_MARKER - !ruby/object:Virtual::IntegerConstantRETURN_MARKER integer: 4RETURN_MARKER value: *4RETURN_MARKER name: :someRETURN_MARKER name: :someRETURN_MARKER value: *5RETURN_MARKER name: :while_1RETURN_MARKER other: &7 !ruby/object:Virtual::LabelRETURN_MARKER next: RETURN_MARKER name: :while_1RETURN_MARKER name: :nRETURN_MARKER name: while_startRETURN_MARKER name: :aRETURN_MARKER value: *6RETURN_MARKER current: *7RETURN_MARKER"
|
@output = "---RETURN_MARKER- !ruby/object:Virtual::MethodDefinitionRETURN_MARKER name: :fibonaccitRETURN_MARKER args:RETURN_MARKER - !ruby/object:Virtual::ArgumentRETURN_MARKER name: :nRETURN_MARKER type: !ruby/object:Virtual::Mystery {}RETURN_MARKER locals:RETURN_MARKER - !ruby/object:Virtual::LocalRETURN_MARKER name: :aRETURN_MARKER type: &2 !ruby/object:Virtual::IntegerConstantRETURN_MARKER integer: 0RETURN_MARKER - !ruby/object:Virtual::LocalRETURN_MARKER name: :someRETURN_MARKER type: !ruby/object:Virtual::IntegerConstantRETURN_MARKER integer: 43RETURN_MARKER - &1 !ruby/object:Virtual::LocalRETURN_MARKER name: :otherRETURN_MARKER type: !ruby/object:Virtual::ReturnRETURN_MARKER name: :returnRETURN_MARKER type: !ruby/class 'Virtual::Mystery'RETURN_MARKER tmps: []RETURN_MARKER receiver: !ruby/object:Virtual::SelfReferenceRETURN_MARKER clazz: RETURN_MARKER return_type: *1RETURN_MARKER start: !ruby/object:Virtual::MethodEnterRETURN_MARKER next: !ruby/object:Virtual::FrameSetRETURN_MARKER name: :aRETURN_MARKER value: *2RETURN_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
|
check
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ def retvar(n)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
HERE
|
HERE
|
||||||
@output = [Virtual::MethodDefinition.new(:foo,[Ast::NameExpression.new(:x)])]
|
@output = ""
|
||||||
check
|
check
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
require_relative '../helper'
|
require_relative '../helper'
|
||||||
require 'parslet/convenience'
|
require 'parslet/convenience'
|
||||||
require "yaml"
|
|
||||||
|
|
||||||
module VirtualHelper
|
module VirtualHelper
|
||||||
# need a code generator, for arm
|
# need a code generator, for arm
|
||||||
@ -20,3 +19,18 @@ module VirtualHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
require "yaml" # not my first choice, but easy with graphs
|
||||||
|
# for readability of the yaml output :next of instructions last
|
||||||
|
|
||||||
|
Psych::Visitors::YAMLTree.class_eval do
|
||||||
|
private
|
||||||
|
def dump_ivars target
|
||||||
|
ivars = find_ivars target
|
||||||
|
ivars << :@next if ivars.delete(:@next)
|
||||||
|
ivars.each do |iv|
|
||||||
|
@emitter.scalar("#{iv.to_s.sub(/^@/, '')}", nil, nil, true, false, Psych::Nodes::Scalar::ANY)
|
||||||
|
accept target.instance_variable_get(iv)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user