fix all tests for previous commit
This commit is contained in:
parent
74b790250a
commit
37eeb81f45
@ -19,8 +19,8 @@ module RubyX
|
||||
attr_reader :vool
|
||||
|
||||
# initialize boots Parfait and Risc (ie load Builin)
|
||||
def initialize
|
||||
Parfait.boot!
|
||||
def initialize(options)
|
||||
Parfait.boot!(options)
|
||||
Risc.boot!
|
||||
end
|
||||
|
||||
@ -96,8 +96,8 @@ module RubyX
|
||||
end
|
||||
|
||||
|
||||
def self.ruby_to_binary( ruby , platform)
|
||||
compiler = RubyXCompiler.new
|
||||
def self.ruby_to_binary( ruby , platform , options)
|
||||
compiler = RubyXCompiler.new(options)
|
||||
compiler.ruby_to_vool(ruby)
|
||||
|
||||
# integrate other sources into vool tree
|
||||
|
@ -22,7 +22,7 @@ class RubyXC < Thor
|
||||
end
|
||||
puts "compiling #{file}"
|
||||
|
||||
linker = ::RubyX::RubyXCompiler.new.ruby_to_binary( ruby , :arm )
|
||||
linker = ::RubyX::RubyXCompiler.new({}).ruby_to_binary( ruby , :arm )
|
||||
writer = Elf::ObjectWriter.new(linker)
|
||||
|
||||
outfile = file.split("/").last.gsub(".rb" , ".o")
|
||||
|
@ -15,7 +15,7 @@ module Arm
|
||||
end
|
||||
module ArmHelper
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@machine = Arm::ArmMachine
|
||||
@binary = FakeBin.new
|
||||
Risc::Position.clear_positions
|
||||
|
@ -25,7 +25,7 @@ module Arm
|
||||
assert_nil code.branch_to
|
||||
end
|
||||
def test_method_call
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
bin = Parfait::BinaryCode.new(1)
|
||||
Risc::Position.new(bin).set(0x20)
|
||||
code = @machine.call( bin ,{} )#this jumps to the next instruction
|
||||
|
@ -4,7 +4,7 @@ module Arm
|
||||
class TestTranslator < MiniTest::Test
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@jump = Risc::DynamicJump.new("" , :r1)
|
||||
@codes = Translator.new.translate @jump
|
||||
end
|
||||
|
@ -17,7 +17,7 @@ module Elf
|
||||
in_space("def main(arg);#{input};end")
|
||||
end
|
||||
def check(input, file)
|
||||
linker = RubyX::RubyXCompiler.new.ruby_to_binary( input , :arm )
|
||||
linker = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_binary( input , :arm )
|
||||
writer = Elf::ObjectWriter.new(linker)
|
||||
writer.save "test/#{file}.o"
|
||||
end
|
||||
|
@ -6,7 +6,7 @@ module Elf
|
||||
|
||||
def setup
|
||||
super
|
||||
@linker = RubyX::RubyXCompiler.new.ruby_to_risc(as_main("return 1"),:arm)
|
||||
@linker = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_risc(as_main("return 1"),:arm)
|
||||
@linker.position_all
|
||||
@linker.create_binary
|
||||
end
|
||||
|
@ -29,7 +29,7 @@ module Risc
|
||||
end
|
||||
def produce_instructions
|
||||
assert @expect , "No output given"
|
||||
linker = RubyX::RubyXCompiler.new.ruby_to_risc(as_test_main,:interpreter)
|
||||
linker = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_risc(as_test_main,:interpreter)
|
||||
compiler = linker.assemblers.find{|c| c.callable.name == :main and c.callable.self_type.object_class.name == :Test}
|
||||
compiler.instructions
|
||||
end
|
||||
|
@ -4,7 +4,7 @@ module Mom
|
||||
|
||||
class TestSlotDefinitionConstant < MiniTest::Test
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@compiler = Risc::FakeCompiler.new
|
||||
@definition = SlotDefinition.new(StringConstant.new("hi") , [])
|
||||
@register = @definition.to_register(@compiler , InstructionMock.new)
|
||||
|
@ -3,7 +3,7 @@ require_relative "helper"
|
||||
module Mom
|
||||
class TestSlotDefinitionKnown1 < MiniTest::Test
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@compiler = Risc::FakeCompiler.new
|
||||
@definition = SlotDefinition.new(:message , :caller)
|
||||
@register = @definition.to_register(@compiler , "fake source")
|
||||
|
@ -3,7 +3,7 @@ require_relative "helper"
|
||||
module Mom
|
||||
class TestSlotDefinitionKnown2 < MiniTest::Test
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@compiler = Risc::FakeCompiler.new
|
||||
@definition = SlotDefinition.new(:message , [:caller , :type])
|
||||
@register = @definition.to_register(@compiler , InstructionMock.new)
|
||||
|
@ -4,7 +4,7 @@ module Mom
|
||||
class TestSlotLoad1 < MiniTest::Test
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
load = SlotLoad.new( [:message, :caller] , [:message,:type] )
|
||||
@compiler = Risc::FakeCompiler.new
|
||||
load.to_risc(@compiler)
|
||||
|
@ -4,7 +4,7 @@ module Mom
|
||||
class TestSlotLoad2 < MiniTest::Test
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@compiler = Risc::FakeCompiler.new
|
||||
load = SlotLoad.new( [:message, :caller, :type] , [:message, :caller , :type] )
|
||||
load.to_risc(@compiler)
|
||||
|
@ -6,7 +6,7 @@ module Vool
|
||||
include MomCompile
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@ret = compile_mom( as_test_main("self.main {|elem| elem = 5 } "))
|
||||
end
|
||||
def test_is_compiler
|
||||
@ -22,7 +22,7 @@ module Vool
|
||||
class TestBlockLocal < MiniTest::Test
|
||||
include MomCompile
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@ret = compile_mom( as_test_main("self.main {|elem| local = 5 } "))
|
||||
@block = @ret.method_compilers.first.get_method.blocks
|
||||
end
|
||||
@ -43,7 +43,7 @@ module Vool
|
||||
include MomCompile
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
end
|
||||
def test_method_arg_compiles
|
||||
ret = compile_mom( as_test_main("self.main {|elem| arg = 5 } "))
|
||||
|
@ -6,7 +6,7 @@ module Vool
|
||||
include MomCompile
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@ret = compile_mom( as_test_main("return 1"))
|
||||
end
|
||||
|
||||
|
@ -5,7 +5,7 @@ module Mom
|
||||
include MomCompile
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@comp = compile_mom( "class Test ; def main(); return 'Hi'; end; end;")
|
||||
end
|
||||
|
||||
|
@ -5,7 +5,7 @@ module Mom
|
||||
include MomCompile
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@comp = compile_mom( "class Test ; def main(); main{return 'Ho'};return 'Hi'; end; end;")
|
||||
@linker = @comp.translate(:interpreter)
|
||||
end
|
||||
|
@ -23,6 +23,16 @@ module Parfait
|
||||
def test_get_next_object
|
||||
assert_equal Parfait::Integer , @factory.get_next_object.class
|
||||
end
|
||||
def test_default_page
|
||||
assert_equal 1024 , Factory.page_size
|
||||
end
|
||||
def test_default_reserve
|
||||
assert_equal 10 , Factory.reserve_size
|
||||
end
|
||||
def test_set_page
|
||||
assert_equal 10 , Factory.page_size = 10
|
||||
Factory.page_size = 1024
|
||||
end
|
||||
def test_first_is_reserve
|
||||
@factory.get_next_object
|
||||
assert_equal Parfait::Integer , @factory.reserve.class
|
||||
|
@ -4,7 +4,7 @@ module Parfait
|
||||
class TestEmptyWord < ParfaitTest
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@word = Parfait::Word.new(0)
|
||||
end
|
||||
def test_word_create
|
||||
|
@ -21,7 +21,7 @@ module Risc
|
||||
end
|
||||
class DummyPlatform
|
||||
def self.boot
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Risc.boot!
|
||||
end
|
||||
def translator
|
||||
|
@ -4,7 +4,7 @@ require 'minitest/mock'
|
||||
module Risc
|
||||
class TestBranchListenerBooted < MiniTest::Test
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Risc.boot!
|
||||
@binary = Parfait::BinaryCode.new(1)
|
||||
@bin_pos = CodeListener.init(@binary,:interpreter).set(0)
|
||||
|
@ -3,7 +3,7 @@ require_relative "helper"
|
||||
module Risc
|
||||
class TestCodeListener < MiniTest::Test
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@binary = Parfait::BinaryCode.new(1)
|
||||
@method = Parfait.object_space.types.values.first.methods
|
||||
@label = Risc.label("hi","ho")
|
||||
|
@ -3,7 +3,7 @@ require_relative "helper"
|
||||
module Risc
|
||||
class TestCodeListenerFull < MiniTest::Test
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Risc.boot!
|
||||
@linker = Mom::MomCompiler.new.translate(:interpreter)
|
||||
@binary = Parfait::BinaryCode.new(1)
|
||||
|
@ -3,7 +3,7 @@ require_relative "helper"
|
||||
module Risc
|
||||
class TestPositionTranslated < MiniTest::Test
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Risc.boot!
|
||||
@binary = Parfait::BinaryCode.new(1)
|
||||
@method = Parfait.object_space.types.values.first.methods
|
||||
|
@ -3,7 +3,7 @@ require_relative "helper"
|
||||
module Risc
|
||||
class TestInstructionListener < MiniTest::Test
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@binary = Parfait::BinaryCode.new(1)
|
||||
@bin_pos = Position.new(@binary).set(0)
|
||||
@instruction = DummyInstruction.new(DummyInstruction.new)
|
||||
|
@ -4,7 +4,7 @@ module Risc
|
||||
class TestLabelListener < MiniTest::Test
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@label = Label.new("Hi","Ho" , FakeAddress.new(5))
|
||||
@label_pos = Position.new(@label ).set(4)
|
||||
@code = Parfait::BinaryCode.new(1)
|
||||
|
@ -14,7 +14,7 @@ module Risc
|
||||
assert !@pos.valid?
|
||||
end
|
||||
def test_next_slot
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
mov = Arm::ArmMachine.mov(:r1 , :r1)
|
||||
position = Position.new(mov ).set(0)
|
||||
assert_equal 4, position.next_slot
|
||||
|
@ -3,7 +3,7 @@ require_relative "helper"
|
||||
module Risc
|
||||
class TestMachinePositions < MiniTest::Test
|
||||
def setup_for(platform)
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Risc.boot!
|
||||
@linker = Mom::MomCompiler.new.translate(platform)
|
||||
@linker.position_all
|
||||
|
@ -4,7 +4,7 @@ module Risc
|
||||
class TestCodeBuilder < MiniTest::Test
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Risc.boot!
|
||||
init = Parfait.object_space.get_init
|
||||
@builder = Risc::MethodCompiler.new( init ).builder(init)
|
||||
|
@ -4,7 +4,7 @@ module Risc
|
||||
class TestCompilerBuilder < MiniTest::Test
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Risc.boot!
|
||||
@init = Parfait.object_space.get_init
|
||||
@compiler = Risc::MethodCompiler.new( @init )
|
||||
|
@ -4,7 +4,7 @@ module Risc
|
||||
class TestBuilderInfer < MiniTest::Test
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Risc.boot!
|
||||
@init = Parfait.object_space.get_init
|
||||
@compiler = Risc::MethodCompiler.new( @init )
|
||||
|
@ -4,7 +4,7 @@ module Risc
|
||||
class TestBuiltinFunction < MiniTest::Test
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
end
|
||||
def test_has_boot_function
|
||||
assert Builtin.boot_functions
|
||||
|
@ -4,7 +4,7 @@ module Risc
|
||||
class TestCollector < MiniTest::Test
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Risc.boot!
|
||||
@linker = Mom::MomCompiler.new.translate(:arm)
|
||||
end
|
||||
|
@ -3,7 +3,7 @@ require_relative "helper"
|
||||
module Risc
|
||||
class TestInterpreterBasics < MiniTest::Test
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Risc.boot!
|
||||
@linker = Mom::MomCompiler.new.translate(:interpreter)
|
||||
end
|
||||
|
@ -21,7 +21,7 @@ module Risc
|
||||
class TestIdentityTranslator < MiniTest::Test
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Risc.boot!
|
||||
@translator = IdentityTranslator.new
|
||||
end
|
||||
|
@ -4,7 +4,7 @@ module Risc
|
||||
class TestLinkerObjects < MiniTest::Test
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Risc.boot!
|
||||
@linker = Mom::MomCompiler.new.translate(:arm)
|
||||
end
|
||||
@ -19,7 +19,7 @@ module Risc
|
||||
end
|
||||
class TestLinkerInit < MiniTest::Test
|
||||
def setup
|
||||
@linker = RubyX::RubyXCompiler.new.ruby_to_binary("class Space;def main;return 1;end;end",:arm)
|
||||
@linker = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_binary("class Space;def main;return 1;end;end",:arm)
|
||||
end
|
||||
def test_pos_cpu
|
||||
assert_equal 0 , Position.get(@linker.cpu_init).at
|
||||
|
@ -4,7 +4,7 @@ module Risc
|
||||
class TestMachinePos < MiniTest::Test
|
||||
def setup
|
||||
code = "class Space; def main(arg);a = 1;return a;end;end"
|
||||
@linker = RubyX::RubyXCompiler.new.ruby_to_risc(code,:arm)
|
||||
@linker = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_risc(code,:arm)
|
||||
@linker.position_all
|
||||
end
|
||||
def test_positions_set
|
||||
|
@ -8,12 +8,12 @@ module Risc
|
||||
end
|
||||
|
||||
def in_test_vool(str)
|
||||
vool = RubyX::RubyXCompiler.new.ruby_to_vool(in_Test(str))
|
||||
vool = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_vool(in_Test(str))
|
||||
vool.to_mom(nil)
|
||||
vool
|
||||
end
|
||||
def in_test_mom(str)
|
||||
RubyX::RubyXCompiler.new(in_Test(str)).ruby_to_mom()
|
||||
FIXMERubyX::RubyXCompiler.new(in_Test(str)).ruby_to_mom()
|
||||
end
|
||||
def create_method(body = "@ivar = 5")
|
||||
in_test_vool("def meth; #{body};end")
|
||||
@ -64,7 +64,7 @@ module Risc
|
||||
assert_equal 2 , method.frame_type.variable_index(:a)
|
||||
end
|
||||
def constant_setup(input)
|
||||
mom = RubyX::RubyXCompiler.new.ruby_to_mom(in_Test(input))
|
||||
mom = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom(in_Test(input))
|
||||
assert_equal Mom::MomCompiler , mom.class
|
||||
compiler = mom.method_compilers.first
|
||||
assert_equal MethodCompiler , compiler.class
|
||||
|
@ -4,7 +4,7 @@ module Risc
|
||||
class TestPadding < MiniTest::Test
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
end
|
||||
|
||||
def test_small
|
||||
|
@ -4,7 +4,7 @@ module Parfait
|
||||
class TestAdapter < MiniTest::Test
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
end
|
||||
|
||||
def test_list_create_from_array
|
||||
|
@ -10,7 +10,7 @@ module Risc
|
||||
class TestRegisterValue < MiniTest::Test
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@r0 = RegisterValue.new(:r0 , :Message)
|
||||
@r1 = RegisterValue.new(:r1 , :Space)
|
||||
@r2 = RegisterValue.new(:r1 , :Factory)
|
||||
|
@ -4,7 +4,7 @@ module Risc
|
||||
class TestRegisterValue1 < MiniTest::Test
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@r0 = RegisterValue.new(:r0 , :Message)
|
||||
@r1 = RegisterValue.new(:r1 , :Space)
|
||||
@compiler = FakeCompiler.new
|
||||
|
@ -4,7 +4,7 @@ module Risc
|
||||
class TestTextWriter < MiniTest::Test
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Risc.boot!
|
||||
@linker = Mom::MomCompiler.new.translate(:arm)
|
||||
end
|
||||
@ -19,7 +19,7 @@ module Risc
|
||||
class TestTextWriterPositions < MiniTest::Test
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Risc.boot!
|
||||
@linker = Mom::MomCompiler.new.translate(:arm)
|
||||
@linker.position_all
|
||||
|
@ -4,7 +4,7 @@ module Risc
|
||||
class TestTranslator < MiniTest::Test
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@translator = Arm::Translator.new
|
||||
end
|
||||
|
||||
|
@ -3,14 +3,14 @@ require_relative "../helper"
|
||||
module Ruby
|
||||
module RubyTests
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
end
|
||||
def compile(input)
|
||||
RubyCompiler.compile(input)
|
||||
end
|
||||
|
||||
def ruby_to_vool(input)
|
||||
RubyXCompiler.new(input).ruby_to_vool
|
||||
FIXMERubyXCompiler.new(input).ruby_to_vool
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -51,7 +51,7 @@ module Ruby
|
||||
include RubyTests
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
end
|
||||
def compile_const( input )
|
||||
lst = compile( input )
|
||||
@ -83,7 +83,7 @@ module Ruby
|
||||
include RubyTests
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
end
|
||||
def compile_const( input )
|
||||
lst = compile( input )
|
||||
|
@ -67,7 +67,7 @@ module Ruby
|
||||
include RubyTests
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
end
|
||||
|
||||
def test_int_receiver
|
||||
|
@ -1,6 +1,7 @@
|
||||
require_relative "../helper"
|
||||
|
||||
module RubyX
|
||||
|
||||
module RubyXHelper
|
||||
def setup
|
||||
end
|
||||
@ -9,10 +10,10 @@ module RubyX
|
||||
mom.translate(platform)
|
||||
end
|
||||
def ruby_to_vool(input)
|
||||
RubyXCompiler.new.ruby_to_vool(input)
|
||||
RubyXCompiler.new(RubyX.default_test_options).ruby_to_vool(input)
|
||||
end
|
||||
def ruby_to_mom(input)
|
||||
RubyXCompiler.new.ruby_to_mom(input)
|
||||
RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom(input)
|
||||
end
|
||||
def compile_in_test( input )
|
||||
vool = ruby_to_vool in_Test(input)
|
||||
|
@ -22,7 +22,7 @@ module RubyX
|
||||
end
|
||||
|
||||
def test_space_is_unchanged_by_compile
|
||||
compiler = RubyXCompiler.new
|
||||
compiler = RubyXCompiler.new(RubyX.default_test_options)
|
||||
space1 = Parfait.object_space.get_class_by_name(:Space)
|
||||
compiler.ruby_to_vool "class Space ;end"
|
||||
space2 = Parfait.object_space.get_class_by_name(:Space)
|
||||
@ -30,7 +30,7 @@ module RubyX
|
||||
end
|
||||
|
||||
def test_space_type_is_unchanged_by_compile
|
||||
compiler = RubyXCompiler.new
|
||||
compiler = RubyXCompiler.new(RubyX.default_test_options)
|
||||
space1 = Parfait.object_space.get_type_by_class_name(:Space)
|
||||
compiler.ruby_to_vool "class Space ;end"
|
||||
space2 = Parfait.object_space.get_type_by_class_name(:Space)
|
||||
|
@ -25,7 +25,7 @@ module RubyX
|
||||
end
|
||||
|
||||
def test_space_type_is_unchanged_by_compile
|
||||
compiler = RubyXCompiler.new
|
||||
compiler = RubyXCompiler.new(RubyX.default_test_options)
|
||||
space1 = Parfait.object_space.get_type_by_class_name(:Space)
|
||||
compiler.ruby_to_vool "class Space ;end"
|
||||
space2 = Parfait.object_space.get_type_by_class_name(:Space)
|
||||
|
@ -9,23 +9,23 @@ module RubyX
|
||||
"class Space ; def #{name}(arg);return arg;end; end"
|
||||
end
|
||||
def test_return_linker
|
||||
@linker = RubyXCompiler.ruby_to_binary(space_source_for("main"), :interpreter)
|
||||
@linker = RubyXCompiler.ruby_to_binary(space_source_for("main"), :interpreter , RubyX.default_test_options)
|
||||
assert_equal Risc::Linker , @linker.class
|
||||
end
|
||||
def test_one_vool_call
|
||||
compiler = RubyXCompiler.new
|
||||
compiler = RubyXCompiler.new(RubyX.default_test_options)
|
||||
compiler.ruby_to_vool(space_source_for("main"))
|
||||
assert_equal Vool::ClassStatement , compiler.vool.class
|
||||
end
|
||||
def test_two_vool_calls
|
||||
compiler = RubyXCompiler.new
|
||||
compiler = RubyXCompiler.new(RubyX.default_test_options)
|
||||
compiler.ruby_to_vool(space_source_for("main"))
|
||||
compiler.ruby_to_vool(space_source_for("twain"))
|
||||
assert_equal Vool::ScopeStatement , compiler.vool.class
|
||||
assert_equal 2 , compiler.vool.length
|
||||
end
|
||||
def test_bin_two_sources
|
||||
compiler = RubyXCompiler.new
|
||||
compiler = RubyXCompiler.new(RubyX.default_test_options)
|
||||
compiler.ruby_to_vool(space_source_for("main"))
|
||||
compiler.ruby_to_vool(space_source_for("twain"))
|
||||
linker = compiler.to_binary(:interpreter)
|
||||
|
@ -22,7 +22,7 @@ module MomCompile
|
||||
include ScopeHelper
|
||||
|
||||
def compile_method(input)
|
||||
statements = RubyX::RubyXCompiler.new.ruby_to_vool(input)
|
||||
statements = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_vool(input)
|
||||
assert statements.is_a?(Vool::ClassStatement)
|
||||
ret = statements.to_mom(nil)
|
||||
assert_equal Parfait::Class , statements.clazz.class , statements
|
||||
@ -50,7 +50,7 @@ module MomCompile
|
||||
block.body.to_mom(block_c)
|
||||
end
|
||||
def compile_mom(input)
|
||||
RubyX::RubyXCompiler.new.ruby_to_mom(input)
|
||||
RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom(input)
|
||||
end
|
||||
|
||||
def check_array( should , is )
|
||||
|
11
test/support/options.rb
Normal file
11
test/support/options.rb
Normal file
@ -0,0 +1,11 @@
|
||||
module Parfait
|
||||
def self.default_test_options
|
||||
{}
|
||||
end
|
||||
end
|
||||
|
||||
module RubyX
|
||||
def self.default_test_options
|
||||
{ parfait: Parfait.default_test_options}
|
||||
end
|
||||
end
|
@ -2,7 +2,7 @@ module Parfait
|
||||
class ParfaitTest < MiniTest::Test
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@space = Parfait.object_space
|
||||
end
|
||||
def make_method
|
||||
|
@ -7,7 +7,8 @@ module Risc
|
||||
include ScopeHelper
|
||||
|
||||
def setup
|
||||
@linker = RubyX::RubyXCompiler.new.ruby_to_binary(@string_input, :interpreter)
|
||||
compiler = RubyX::RubyXCompiler.new(RubyX.default_test_options)
|
||||
@linker = compiler.ruby_to_binary(@string_input, :interpreter)
|
||||
@interpreter = Interpreter.new(@linker)
|
||||
@interpreter.start_program
|
||||
end
|
||||
|
@ -5,7 +5,7 @@ module VoolBlocks
|
||||
include MomCompile
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@ins = compile_first_block( "local = 5")
|
||||
end
|
||||
|
||||
@ -32,7 +32,7 @@ module VoolBlocks
|
||||
class TestAssignMomInstanceToLocal < MiniTest::Test
|
||||
include MomCompile
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@ins = compile_first_block( "local = @a" , "@a = 5") #second arg in method scope
|
||||
end
|
||||
def test_class_compiles
|
||||
@ -50,7 +50,7 @@ module VoolBlocks
|
||||
include MomCompile
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@ins = compile_first_block( "arg = 5")
|
||||
end
|
||||
|
||||
@ -68,7 +68,7 @@ module VoolBlocks
|
||||
class TestAssignMomToInstance < MiniTest::Test
|
||||
include MomCompile
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
end
|
||||
def test_assigns_const
|
||||
@ins = compile_first_block( "@a = 5")
|
||||
|
@ -6,7 +6,7 @@ module VoolBlocks
|
||||
include Mom
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Risc::Builtin.boot_functions
|
||||
@ins = compile_first_block( "if(5.div4) ; @a = 6 ; else; @a = 5 ; end")
|
||||
end
|
||||
|
@ -6,7 +6,7 @@ module VoolBlocks
|
||||
include Mom
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@ins = compile_first_block( "while(@a) ; @a = 5 ; end")
|
||||
end
|
||||
|
||||
|
@ -6,7 +6,7 @@ module Vool
|
||||
include MomCompile
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Risc::Builtin.boot_functions
|
||||
@ins = compile_first_method( send_method )
|
||||
end
|
||||
|
@ -6,7 +6,7 @@ module Vool
|
||||
include Mom
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Risc.boot!
|
||||
@ins = compile_first_method( "a = main(1 + 2)" )
|
||||
end
|
||||
|
@ -6,7 +6,7 @@ module Vool
|
||||
include Mom
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@ins = compile_first_method( "a = 5; a.div4")
|
||||
end
|
||||
def test_check_type
|
||||
|
@ -5,7 +5,7 @@ module Vool
|
||||
include MomCompile
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@ins = compile_first_method( "local = 5")
|
||||
end
|
||||
|
||||
@ -36,7 +36,7 @@ module Vool
|
||||
class TestAssignMomInstanceToLocal < MiniTest::Test
|
||||
include MomCompile
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@ins = compile_first_method( "@a = 5 ; local = @a")
|
||||
end
|
||||
def test_class_compiles
|
||||
@ -49,7 +49,7 @@ module Vool
|
||||
include MomCompile
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@ins = compile_first_method( "arg = 5")
|
||||
end
|
||||
|
||||
@ -73,7 +73,7 @@ module Vool
|
||||
class TestAssignMomToInstance < MiniTest::Test
|
||||
include MomCompile
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
end
|
||||
def test_assigns_const
|
||||
@ins = compile_first_method( "@a = 5")
|
||||
|
@ -6,7 +6,7 @@ module Vool
|
||||
include Mom
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Risc::Builtin.boot_functions
|
||||
@ins = compile_first_method( "if(5.div4) ; @a = 6 ; else; @a = 5 ; end")
|
||||
end
|
||||
|
@ -7,7 +7,7 @@ module Vool
|
||||
include Mom
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@ins = compile_first_method( "if(@a) ; @a = 5 ; end")
|
||||
end
|
||||
|
||||
|
@ -7,7 +7,7 @@ module Vool
|
||||
include Mom
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@ins = compile_first_method( "if(@a) ; @a = 5 ; else; @a = 6 ; end")
|
||||
end
|
||||
|
||||
|
@ -5,7 +5,7 @@ module Vool
|
||||
include MomCompile
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@ins = compile_first_method( "@a = 5")
|
||||
end
|
||||
|
||||
|
@ -5,7 +5,7 @@ module Vool
|
||||
include MomCompile
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@ins = compile_first_method( "a = 5")
|
||||
end
|
||||
|
||||
|
@ -6,7 +6,7 @@ module Vool
|
||||
include Mom
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@inst = compile_first_method( "return 5")
|
||||
end
|
||||
|
||||
@ -43,7 +43,7 @@ module Vool
|
||||
include Mom
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Risc.boot!
|
||||
@ins = compile_first_method( "return 5.div4")
|
||||
end
|
||||
|
@ -7,7 +7,7 @@ module Vool
|
||||
include Mom
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Risc::Builtin.boot_functions
|
||||
@ins = compile_first_method( "while(5.div4) ; 5.div4 ; end")
|
||||
end
|
||||
|
@ -6,7 +6,7 @@ module Vool
|
||||
include Mom
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@ins = compile_first_method( "while(@a) ; @a = 5 ; end")
|
||||
end
|
||||
|
||||
|
@ -59,7 +59,7 @@ module Vool
|
||||
include YieldBasics
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@ins = compile_first_method( "return yield(1)" )
|
||||
end
|
||||
|
||||
@ -83,7 +83,7 @@ module Vool
|
||||
include Mom
|
||||
include YieldBasics
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@ins = compile_first_method( "return yield" )
|
||||
end
|
||||
def test_array
|
||||
|
Loading…
Reference in New Issue
Block a user