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