Some vool starting to work again

disabling some rubyx compiler tests
This commit is contained in:
Torsten Rüger
2019-08-07 12:06:06 +03:00
parent 5d1d485565
commit 1237e079f7
14 changed files with 78 additions and 69 deletions

View File

@ -19,23 +19,44 @@ module ScopeHelper
end
module VoolCompile
include ScopeHelper
include Mom
def compile_method(input)
statements = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom(input)
assert statements.is_a?(Mom::MomCollection)
ret = statements.to_mom(nil)
assert_equal Parfait::Class , statements.clazz.class , statements
@method = statements.clazz.get_method(:main)
assert_equal Parfait::VoolMethod , @method.class
ret
collection = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom(input)
assert collection.is_a?(Mom::MomCollection)
compiler = collection.compilers.first
assert compiler.is_a?(Mom::MethodCompiler)
compiler
end
def compile_first_method( input )
ret = compile_method( as_test_main( input ))
assert_equal Mom::MomCompiler , ret.class
compiler = ret.method_compilers.find{|c| c.get_method.name == :main and c.get_method.self_type.object_class.name == :Test}
assert_equal Risc::MethodCompiler , compiler.class
@method.source.to_mom( compiler )
assert_equal Mom::MethodCompiler , ret.class
ret
end
def check_array( should , is )
index = 0
test = is
while(test)
# if we assert here, we get output pointing here. Without stack, not useful
raise "Wrong class for #{index+1}, #{dump(is)}" if should[index] != test.class
index += 1
test = test.next
end
assert 1 #just to get an assertion in the output.
end
def dump(is)
res =[]
while(is)
res << is.class.name.split("::").last
is = is.next
end
ret = ""
res.to_s.split(",").each_slice(5).each do |line|
ret += " " + line.join(",") + " ,\n"
end
ret.gsub('"' , '')
end
end
module MomCompile
@ -73,28 +94,4 @@ module MomCompile
RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom(input)
end
def check_array( should , is )
index = 0
test = is
while(test)
# if we assert here, we get output pointing here. Without stack, not useful
raise "Wrong class for #{index+1}, #{dump(is)}" if should[index] != test.class
index += 1
test = test.next
end
assert 1 #just to get an assertion in the output.
end
def dump(is)
res =[]
while(is)
res << is.class.name.split("::").last
is = is.next
end
ret = ""
res.to_s.split(",").each_slice(5).each do |line|
ret += " " + line.join(",") + " ,\n"
end
ret.gsub('"' , '')
end
end