diff --git a/test/rubyx/rt_parfait/helper.rb b/test/rubyx/rt_parfait/helper.rb index 9f3e9941..5ea613b4 100644 --- a/test/rubyx/rt_parfait/helper.rb +++ b/test/rubyx/rt_parfait/helper.rb @@ -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) diff --git a/test/rubyx/rt_parfait/test_object.rb b/test/rubyx/rt_parfait/test_object.rb index f135ad2e..e7217795 100644 --- a/test/rubyx/rt_parfait/test_object.rb +++ b/test/rubyx/rt_parfait/test_object.rb @@ -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