using yaml as the storage format of the result as it handles graphs out of the box

This commit is contained in:
Torsten Ruger 2014-07-18 00:30:36 +03:00
parent 98db88ac2f
commit 2e79caa791
2 changed files with 4 additions and 2 deletions

View File

@ -23,7 +23,7 @@ module Virtual
end
def inspect
self.class.name + ".new(" + attributes.collect{|a| send(a).inspect }.join(",")+ ")"
to_yaml
end
def self.space

View File

@ -1,5 +1,6 @@
require_relative '../helper'
require 'parslet/convenience'
require "yaml"
module VirtualHelper
# need a code generator, for arm
@ -14,7 +15,8 @@ module VirtualHelper
machine = Virtual::Machine.new
main = Virtual::MethodDefinition.main
expressions = parts.compile(machine.frame , main )
assert_equal @output , expressions
should = YAML.load(@output.gsub("_MY_MY_MARKER" , "\n"))
assert_equal should , expressions , expressions.to_yaml.gsub("\n" , "_MY_MY_MARKER") + "\n" + expressions.to_yaml
end
end