Start on parsing parfait tests

Hanging on .new currently, but there is surely more
This commit is contained in:
Torsten Rüger 2019-09-09 11:48:29 +03:00
parent 0ae7c5d8aa
commit 104f4c5109
2 changed files with 39 additions and 3 deletions

View File

@ -8,7 +8,7 @@
class ParfaitTest
def setup
@space = Parfait.object_space
@space = Object.object_space # this mapping wil have to be added to compiler
end
def assert(arg)
return unless(arg)

View File

@ -4,7 +4,42 @@ module RubyX
class ObjectTest < MiniTest::Test
include ParfaitHelper
def setup
@input = load_parfait(:object) #+ load_parfait_test(:object)
@input = load_parfait(:object) + load_parfait_test(:object)
end
def test_load
assert @input.include? "ParfaitTest"
assert @input.include? "class Object"
end
def test_compile
compiled = Ruby::RubyCompiler.compile(@input)
assert_equal Ruby::ScopeStatement , compiled.class
assert_equal Ruby::ClassStatement , compiled.first.class
end
def test_require
compiled = Ruby::RubyCompiler.compile(@input)
assert_equal Ruby::SendStatement , compiled[1].class
assert_equal :require_relative , compiled[1].name
end
def test_test_class
compiled = Ruby::RubyCompiler.compile(@input)
assert_equal Ruby::ClassStatement , compiled[2].class
assert_equal :TestObject , compiled[2].name
end
def test_vool_object
vool = Ruby::RubyCompiler.compile(@input).to_vool
assert_equal Vool::ScopeStatement , vool.class
assert_equal Vool::ClassExpression , vool.first.class
end
def test_vool_helper
vool = Ruby::RubyCompiler.compile(@input).to_vool
assert_equal Vool::ClassExpression , vool[1].class
assert_equal :ParfaitTest , vool[1].name
end
def test_vool_test
vool = Ruby::RubyCompiler.compile(@input).to_vool
assert_equal Vool::ClassExpression , vool[2].class
assert_equal :TestObject , vool[2].name
end
def test_basics
@ -13,8 +48,9 @@ module RubyX
end
def test_run_all
@input += "class Space;def main(arg);::Parfait::Object.new;end;end"
@input += "class Space;def main(arg);'Object'.putstring;end;end"
run_input
assert_equal "Object" , @interpreter.stdout
end
end
end