Implicit returns for class methods
gets us parsing of parfaits second file data_object
This commit is contained in:
@ -2,7 +2,7 @@ require_relative "helper"
|
||||
|
||||
module RubyX
|
||||
|
||||
class TestDatObjectCompile #< MiniTest::Test
|
||||
class TestDatObjectCompile < MiniTest::Test
|
||||
include ParfaitHelper
|
||||
def setup
|
||||
@compiler = compiler
|
||||
@ -17,23 +17,23 @@ module RubyX
|
||||
end
|
||||
def test_vool
|
||||
vool = @compiler.ruby_to_vool source
|
||||
assert_equ Vool::ScopeStatement , vool.class
|
||||
assert_equal Vool::ClassStatement , vool[0].class
|
||||
assert_equal Vool::ScopeStatement , vool[1].class
|
||||
assert_equal Vool::ClassStatement , vool[1][0].class
|
||||
assert_equal :DataObject , vool[1][0].name
|
||||
assert_equal :Data4 , vool[1][1].name
|
||||
assert_equal :Data8 , vool[1][2].name
|
||||
assert_equal Vool::ScopeStatement , vool.class
|
||||
assert_equal Vool::ClassExpression , vool[0].class
|
||||
assert_equal Vool::ClassExpression , vool[1].class
|
||||
assert_equal Vool::ClassExpression , vool[2].class
|
||||
assert_equal :DataObject , vool[1].name
|
||||
assert_equal :Data4 , vool[2].name
|
||||
assert_equal :Data8 , vool[3].name
|
||||
end
|
||||
def test_mom
|
||||
mom = @compiler.ruby_to_mom source
|
||||
assert_equal Mom::MomCollection , mom.class
|
||||
end
|
||||
def qtest_risc
|
||||
def test_risc
|
||||
risc = compiler.ruby_to_risc source
|
||||
assert_equal Risc::RiscCollection , risc.class
|
||||
end
|
||||
def qtest_binary
|
||||
def test_binary
|
||||
risc = compiler.ruby_to_binary source , :interpreter
|
||||
assert_equal Risc::Linker , risc.class
|
||||
end
|
||||
|
@ -26,22 +26,21 @@ module RubyX
|
||||
assert_equal 22 , linker.assemblers.length
|
||||
end
|
||||
end
|
||||
class TestRubyXCompilerParfait #< MiniTest::Test
|
||||
class TestRubyXCompilerParfait < MiniTest::Test
|
||||
include ScopeHelper
|
||||
include RubyXHelper
|
||||
|
||||
def setup
|
||||
super
|
||||
code = "class Space ; def self.class_method(); return 1; end;def main(arg);return Space.class_method;end; end"
|
||||
@comp = RubyXCompiler.ruby_to_risc(code , load_parfait: true)# , platform: :interpreter)
|
||||
@comp = RubyXCompiler.ruby_to_binary(code , load_parfait: true , platform: :interpreter)
|
||||
end
|
||||
|
||||
def test_load
|
||||
object = Parfait.object_space.get_class_by_name(:Object)
|
||||
assert_equal Parfait::Class , object.class
|
||||
object = object.instance_type
|
||||
object.methods.each_method {|m| puts m.name}
|
||||
assert_equal Parfait::Type , object.get_method(:set_type)
|
||||
#object.methods.each_method {|m| puts m.name}
|
||||
assert_equal Parfait::VoolMethod , object.get_method(:set_type).class
|
||||
assert_equal Parfait::CallableMethod , object.instance_type.get_method(:set_type).class
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user