From 3eef27be761d4005e1165f89fdace5bf766d3ecd Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Fri, 16 Mar 2018 20:25:01 +0530 Subject: [PATCH] test helper cleanup --- test/mom/helper.rb | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/test/mom/helper.rb b/test/mom/helper.rb index a4091ad3..0de3ac50 100644 --- a/test/mom/helper.rb +++ b/test/mom/helper.rb @@ -1,33 +1,10 @@ require_relative '../helper' module Risc - module SpaceHack - # test hack to in place change object type - def add_space_field(name,type) - class_type = Parfait.object_space.get_class_by_name(:Space).instance_type - class_type.send(:private_add_instance_variable, name , type) - end - end - module ExpressionHelper - include SpaceHack - - def check - Risc.machine.boot unless Risc.machine.booted - compiler = Vm::MethodCompiler.new Parfait.object_space.get_main - code = Vm.ast_to_code @input - assert code.to_s , @input - produced = compiler.process( code ) - assert @output , "No output given" - assert_equal produced.class , @output , "Wrong class" - produced - end - - end module Statements include AST::Sexp include CleanCompile - include SpaceHack def setup Risc.machine.boot # force boot to reset main @@ -39,6 +16,12 @@ module Risc def postamble [ Label, FunctionReturn] end + # test hack to in place change object type + def add_space_field(name,type) + class_type = Parfait.object_space.get_class_by_name(:Space).instance_type + class_type.send(:private_add_instance_variable, name , type) + end + def check_nil assert @expect , "No output given" Vool::VoolCompiler.ruby_to_vool "class Space; def main(arg);#{@input};end;end" @@ -60,7 +43,7 @@ module Risc should = full_expect[index] return "No instruction at #{index}\n#{should(all)}" unless should return "Expected at #{index+1}\n#{should(all)}" unless instruction.class == should - puts instruction.to_s + #puts instruction.to_s index += 1 instruction = instruction.next end while( instruction )