diff --git a/lib/rubyx/rubyx_compiler.rb b/lib/rubyx/rubyx_compiler.rb index 3d7898bb..61780677 100644 --- a/lib/rubyx/rubyx_compiler.rb +++ b/lib/rubyx/rubyx_compiler.rb @@ -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 diff --git a/test/rubyx/helper.rb b/test/rubyx/helper.rb index 8d1f8fb4..b57061bb 100644 --- a/test/rubyx/helper.rb +++ b/test/rubyx/helper.rb @@ -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) diff --git a/test/rubyx/test_rubyx_compiler2.rb b/test/rubyx/test_rubyx_compiler2.rb index 87e13fef..a87a50c3 100644 --- a/test/rubyx/test_rubyx_compiler2.rb +++ b/test/rubyx/test_rubyx_compiler2.rb @@ -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 diff --git a/test/rubyx/test_rubyx_compiler3.rb b/test/rubyx/test_rubyx_compiler3.rb index d70cf64b..40cf80a9 100644 --- a/test/rubyx/test_rubyx_compiler3.rb +++ b/test/rubyx/test_rubyx_compiler3.rb @@ -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 diff --git a/test/support/options.rb b/test/support/options.rb index a390ee20..e2872432 100644 --- a/test/support/options.rb +++ b/test/support/options.rb @@ -30,6 +30,7 @@ module RubyX def self.interpreter_test_options { parfait: Parfait.interpreter_test_options, + load_parfait: false , platform: :interpreter } end