Test complied parfait tests
this makes it obvious that we need a working raise and a correct method_missing, so we can diagnose the resulting errors
This commit is contained in:
parent
56398e1127
commit
b36ba42990
@ -31,7 +31,7 @@ module Risc
|
||||
end
|
||||
end
|
||||
|
||||
# dynamic version of an Branch branch that jumps to the contents
|
||||
# dynamic version of an Branch that jumps to the contents
|
||||
# of a register instead of a hardcoded address
|
||||
# As Branches jump to Labels, this is not derived from Branch
|
||||
# PS: to conditionally jump to a dynamic adddress we do a normal branch
|
||||
|
@ -1,6 +1,5 @@
|
||||
require_relative "../helper"
|
||||
|
||||
# TODO move these to interpreter dir
|
||||
module Risc
|
||||
module Macro
|
||||
class IntCmp < Minitest::Test
|
||||
|
@ -1,12 +1,11 @@
|
||||
require_relative "rt_helper"
|
||||
|
||||
module RubyX
|
||||
class ObjectTest < MiniTest::Test
|
||||
class ObjectSourceTest < MiniTest::Test
|
||||
include ParfaitHelper
|
||||
def setup
|
||||
@input = load_parfait(:object) + load_parfait_test(:object)
|
||||
end
|
||||
|
||||
def test_load
|
||||
assert @input.include? "ParfaitTest"
|
||||
assert @input.include? "class Object"
|
||||
@ -41,16 +40,41 @@ module RubyX
|
||||
assert_equal Vool::ClassExpression , vool[2].class
|
||||
assert_equal :TestObject , vool[2].name
|
||||
end
|
||||
|
||||
def est_basics
|
||||
risc = compiler.ruby_to_risc @input , :interpreter
|
||||
assert_equal Risc::Linker , risc.class
|
||||
end
|
||||
|
||||
def test_run_all
|
||||
@input = "class Space;def main(arg); return 'hi';end;end;" + @input
|
||||
run_input
|
||||
assert_equal "" , @interpreter.stdout
|
||||
def test_vool_methods
|
||||
vool = Ruby::RubyCompiler.compile(@input).to_vool
|
||||
assert_equal Vool::Statements , vool[2].body.class
|
||||
vool[2].body.statements.each do |st|
|
||||
assert_equal Vool::MethodExpression , st.class
|
||||
end
|
||||
end
|
||||
end
|
||||
class TestObjectRtTest < Minitest::Test
|
||||
self.class.include ParfaitHelper
|
||||
include Risc::Ticker
|
||||
|
||||
def self.runnable_methods
|
||||
input = load_parfait(:object) + load_parfait_test(:object)
|
||||
vool = Ruby::RubyCompiler.compile(input).to_vool
|
||||
tests = [ ]
|
||||
vool[2].body.statements.each do |method|
|
||||
tests << method.name
|
||||
self.send(:define_method, method.name ) do
|
||||
code = input + <<MAIN
|
||||
class Space
|
||||
def main(args)
|
||||
test = #{vool[2].name}.new
|
||||
test.setup
|
||||
test.#{method.name}
|
||||
end
|
||||
end
|
||||
MAIN
|
||||
@preload = "all"
|
||||
# ticks = run_input(code)
|
||||
# assert_equal "" , @interpreter.stdout
|
||||
end
|
||||
end
|
||||
tests
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user