clean up test option handling
This commit is contained in:
parent
0a75e8c3ba
commit
fb89c01681
@ -103,10 +103,12 @@ module RubyX
|
||||
end
|
||||
end
|
||||
|
||||
def self.ruby_to_binary( ruby , platform , options)
|
||||
def self.ruby_to_binary( ruby , options)
|
||||
compiler = RubyXCompiler.new(options)
|
||||
# compiler.load_parfait
|
||||
compiler.ruby_to_vool(ruby)
|
||||
platform = options[:platform]
|
||||
raise "No platform given" unless platform
|
||||
compiler.to_binary(platform)
|
||||
end
|
||||
end
|
||||
|
@ -5,17 +5,17 @@ module RubyX
|
||||
module RubyXHelper
|
||||
def setup
|
||||
end
|
||||
def ruby_to_risc(input , platform)
|
||||
def ruby_to_risc(input , options = {})
|
||||
mom = ruby_to_mom(input)
|
||||
mom.translate(platform)
|
||||
mom.translate(options[:platform] || :interpreter)
|
||||
end
|
||||
def ruby_to_vool(input)
|
||||
def ruby_to_vool(input, options = {})
|
||||
RubyXCompiler.new(RubyX.default_test_options).ruby_to_vool(input)
|
||||
end
|
||||
def ruby_to_mom(input)
|
||||
def ruby_to_mom(input , options = {})
|
||||
RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom(input)
|
||||
end
|
||||
def compile_in_test( input )
|
||||
def compile_in_test( input , options = {})
|
||||
vool = ruby_to_vool in_Test(input)
|
||||
vool.to_mom(nil)
|
||||
itest = Parfait.object_space.get_class_by_name(:Test)
|
||||
|
@ -8,7 +8,7 @@ module RubyX
|
||||
def setup
|
||||
super
|
||||
code = "class Space ; def main(arg);return arg;end; end"
|
||||
@linker = ruby_to_risc(code, :interpreter)
|
||||
@linker = ruby_to_risc(code)
|
||||
end
|
||||
def test_to_risc
|
||||
assert_equal Risc::Linker , @linker.class
|
||||
|
@ -8,8 +8,13 @@ module RubyX
|
||||
def space_source_for( name )
|
||||
"class Space ; def #{name}(arg);return arg;end; end"
|
||||
end
|
||||
def test_platform_option
|
||||
options = RubyX.interpreter_test_options
|
||||
options.delete(:platform)
|
||||
assert_raises{ RubyXCompiler.ruby_to_binary(space_source_for("main"), options)}
|
||||
end
|
||||
def test_return_linker
|
||||
@linker = RubyXCompiler.ruby_to_binary(space_source_for("main"), :interpreter , RubyX.default_test_options)
|
||||
@linker = RubyXCompiler.ruby_to_binary(space_source_for("main"), RubyX.interpreter_test_options)
|
||||
assert_equal Risc::Linker , @linker.class
|
||||
end
|
||||
def test_one_vool_call
|
||||
|
@ -30,6 +30,7 @@ module RubyX
|
||||
def self.interpreter_test_options
|
||||
{
|
||||
parfait: Parfait.interpreter_test_options,
|
||||
load_parfait: false ,
|
||||
platform: :interpreter
|
||||
}
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user