starting to_risc descent
just fleshing it for now
This commit is contained in:
@ -16,12 +16,12 @@ module Vool
|
||||
end
|
||||
|
||||
def test_compile_class_one
|
||||
itest = compile_in_test "def meth; @ivar; end"
|
||||
itest = compile_in_test "def meth; @ivar = 5; end"
|
||||
assert itest.instance_type.names.include?(:ivar) , itest.instance_type.names.inspect
|
||||
end
|
||||
|
||||
def test_compile_class_two
|
||||
itest = compile_in_test "def meth; @ivar; end;def meth2(arg); @trivar = 5; end"
|
||||
itest = compile_in_test "def meth; @ivar = 5; end;def meth2(arg); @trivar = 5; end"
|
||||
assert itest.instance_type.names.include?(:trivar) , itest.instance_type.names.inspect
|
||||
end
|
||||
|
||||
@ -33,7 +33,7 @@ module Vool
|
||||
end
|
||||
|
||||
def test_class_body_is_scope
|
||||
clazz = VoolCompiler.ruby_to_vool in_Test("def meth; @ivar ;end")
|
||||
clazz = VoolCompiler.ruby_to_vool in_Test("def meth; @ivar = 5 ;end")
|
||||
assert_equal ScopeStatement , clazz.body.class
|
||||
end
|
||||
|
||||
|
@ -9,7 +9,7 @@ module Vool
|
||||
end
|
||||
|
||||
def create_method
|
||||
VoolCompiler.ruby_to_vool in_Test("def meth; @ivar ;end")
|
||||
VoolCompiler.ruby_to_vool in_Test("def meth; @ivar = 5;end")
|
||||
test = Parfait.object_space.get_class_by_name(:Test)
|
||||
test.get_method(:meth)
|
||||
end
|
||||
@ -17,7 +17,7 @@ module Vool
|
||||
def test_method_has_source
|
||||
method = create_method
|
||||
assert_equal ScopeStatement , method.source.class
|
||||
assert_equal InstanceVariable , method.source.statements.first.class
|
||||
assert_equal IvarAssignment , method.source.statements.first.class
|
||||
end
|
||||
|
||||
def test_method_has_no_locals
|
||||
@ -36,24 +36,23 @@ module Vool
|
||||
assert_equal Parfait::VoolMethod , method.class
|
||||
end
|
||||
|
||||
|
||||
def test_creates_method_statement_in_class
|
||||
clazz = VoolCompiler.ruby_to_vool in_Test("def meth; @ivar ;end")
|
||||
clazz = VoolCompiler.ruby_to_vool in_Test("def meth; @ivar = 5 ;end")
|
||||
assert_equal MethodStatement , clazz.body.statements.first.class
|
||||
end
|
||||
|
||||
def test_parfait_class_creation
|
||||
clazz = VoolCompiler.ruby_to_vool in_Test("def meth; @ivar ;end")
|
||||
clazz = VoolCompiler.ruby_to_vool in_Test("def meth; @ivar = 5;end")
|
||||
assert_equal Parfait::Class , clazz.body.statements.first.clazz.class
|
||||
end
|
||||
|
||||
def test_method_statement_has_class
|
||||
clazz = VoolCompiler.ruby_to_vool in_Test("def meth; @ivar ;end")
|
||||
clazz = VoolCompiler.ruby_to_vool in_Test("def meth; @ivar = 5;end")
|
||||
assert clazz.body.statements.first.clazz
|
||||
end
|
||||
|
||||
def test_method_statement_has_class_in_main
|
||||
clazz = VoolCompiler.ruby_to_vool as_main("def meth; @ivar ;end")
|
||||
clazz = VoolCompiler.ruby_to_vool as_main("def meth; @ivar = 5;end")
|
||||
assert clazz.body.statements.first.clazz
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user