Rename Vool to Sol
Simple is really the descriptive name for the layer Sure, it is "virtual" but that is not as important as the fact that it is simple (or simplified) Also objct (based really) is better, since orientated implies it is a little like that, but only orientated, not really it. Sol only has objects, nothing else Just cause i was renaming anyway
This commit is contained in:
@ -12,9 +12,9 @@ module Ruby
|
||||
def compile_main(input)
|
||||
RubyCompiler.compile(as_main(input))
|
||||
end
|
||||
def compile_main_vool(input)
|
||||
def compile_main_sol(input)
|
||||
xcompiler = RubyX::RubyXCompiler.new(RubyX.default_test_options)
|
||||
xcompiler.ruby_to_vool(as_main(input))
|
||||
xcompiler.ruby_to_sol(as_main(input))
|
||||
end
|
||||
|
||||
def assert_raises_muted &block
|
||||
@ -28,25 +28,25 @@ module Ruby
|
||||
include RubyTests
|
||||
def setup
|
||||
super
|
||||
@vool = compile( "class Tryout < Base; #{attr_def};end" ).to_vool
|
||||
@sol = compile( "class Tryout < Base; #{attr_def};end" ).to_sol
|
||||
end
|
||||
def getter
|
||||
@vool.body.statements.first
|
||||
@sol.body.statements.first
|
||||
end
|
||||
def setter
|
||||
@vool.body.statements.last
|
||||
@sol.body.statements.last
|
||||
end
|
||||
def test_class
|
||||
assert_equal Vool::ClassExpression , @vool.class
|
||||
assert_equal Sol::ClassExpression , @sol.class
|
||||
end
|
||||
def test_body
|
||||
assert_equal Vool::Statements , @vool.body.class
|
||||
assert_equal Sol::Statements , @sol.body.class
|
||||
end
|
||||
def test_getter
|
||||
assert_equal Vool::MethodExpression , getter.class
|
||||
assert_equal Sol::MethodExpression , getter.class
|
||||
end
|
||||
def test_getter_return
|
||||
assert_equal Vool::ReturnStatement , getter.body.class
|
||||
assert_equal Sol::ReturnStatement , getter.body.class
|
||||
end
|
||||
def test_getter_name
|
||||
assert_equal :page , getter.name
|
||||
|
@ -25,46 +25,46 @@ module Ruby
|
||||
assert_equal IvarAssignment , lst.class
|
||||
end
|
||||
end
|
||||
class TestAssignmentVoolLocal < MiniTest::Test
|
||||
class TestAssignmentSolLocal < MiniTest::Test
|
||||
include RubyTests
|
||||
def setup
|
||||
@lst = compile( "foo = bar").to_vool
|
||||
@lst = compile( "foo = bar").to_sol
|
||||
end
|
||||
def test_tos
|
||||
assert_equal "foo = self.bar()" , @lst.to_s
|
||||
end
|
||||
def test_local
|
||||
assert_equal Vool::LocalAssignment , @lst.class
|
||||
assert_equal Sol::LocalAssignment , @lst.class
|
||||
end
|
||||
def test_bar
|
||||
assert_equal Vool::SendStatement , @lst.value.class
|
||||
assert_equal Sol::SendStatement , @lst.value.class
|
||||
end
|
||||
def test_local_name
|
||||
assert_equal :foo , @lst.name
|
||||
end
|
||||
end
|
||||
class TestAssignmentVoolInst < MiniTest::Test
|
||||
class TestAssignmentSolInst < MiniTest::Test
|
||||
include RubyTests
|
||||
def setup
|
||||
@lst = compile( "@foo = bar").to_vool
|
||||
@lst = compile( "@foo = bar").to_sol
|
||||
end
|
||||
def test_tos
|
||||
assert_equal "@foo = self.bar()" , @lst.to_s
|
||||
end
|
||||
def test_instance
|
||||
assert_equal Vool::IvarAssignment , @lst.class
|
||||
assert_equal Sol::IvarAssignment , @lst.class
|
||||
end
|
||||
def test_instance_name
|
||||
assert_equal :foo , @lst.name
|
||||
end
|
||||
end
|
||||
class TestAssignmentVoolConst < MiniTest::Test
|
||||
class TestAssignmentSolConst < MiniTest::Test
|
||||
include RubyTests
|
||||
def setup
|
||||
@lst = compile( "foo = 5").to_vool
|
||||
@lst = compile( "foo = 5").to_sol
|
||||
end
|
||||
def test_const
|
||||
assert_equal Vool::IntegerConstant , @lst.value.class
|
||||
assert_equal Sol::IntegerConstant , @lst.value.class
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,30 +1,30 @@
|
||||
require_relative "helper"
|
||||
|
||||
module Ruby
|
||||
class TestVoolCallMulti2 < MiniTest::Test
|
||||
class TestSolCallMulti2 < MiniTest::Test
|
||||
include RubyTests
|
||||
|
||||
include RubyTests
|
||||
def setup
|
||||
@lst = compile( "@foo = a.call(b)").to_vool
|
||||
@lst = compile( "@foo = a.call(b)").to_sol
|
||||
end
|
||||
def test_class
|
||||
assert_equal Vool::Statements , @lst.class
|
||||
assert_equal Sol::Statements , @lst.class
|
||||
end
|
||||
def test_first_class
|
||||
assert_equal Vool::LocalAssignment , @lst[0].class
|
||||
assert_equal Sol::LocalAssignment , @lst[0].class
|
||||
end
|
||||
def test_first_name
|
||||
assert @lst[0].name.to_s.start_with?("tmp_")
|
||||
end
|
||||
def test_second_class
|
||||
assert_equal Vool::LocalAssignment , @lst[1].class
|
||||
assert_equal Sol::LocalAssignment , @lst[1].class
|
||||
end
|
||||
def test_second_name
|
||||
assert @lst[1].name.to_s.start_with?("tmp_")
|
||||
end
|
||||
def test_last_class
|
||||
assert_equal Vool::IvarAssignment , @lst[2].class
|
||||
assert_equal Sol::IvarAssignment , @lst[2].class
|
||||
end
|
||||
def test_second_name
|
||||
assert_equal :foo, @lst[2].name
|
||||
|
@ -79,7 +79,7 @@ module Ruby
|
||||
assert_equal TrueConstant , compile_const( "true")
|
||||
end
|
||||
end
|
||||
class TestBasicTypesVool < MiniTest::Test
|
||||
class TestBasicTypesSol < MiniTest::Test
|
||||
include RubyTests
|
||||
|
||||
def setup
|
||||
@ -87,7 +87,7 @@ module Ruby
|
||||
end
|
||||
def compile_const( input )
|
||||
lst = compile( input )
|
||||
lst.to_vool.to_s
|
||||
lst.to_sol.to_s
|
||||
end
|
||||
def test_integer
|
||||
assert_equal "123" , compile_const( "123")
|
||||
|
@ -40,35 +40,35 @@ module Ruby
|
||||
|
||||
def setup()
|
||||
input = "def self.tryout(arg1, arg2) ; a = arg1 ; end "
|
||||
@lst = compile( input ).to_vool
|
||||
@lst = compile( input ).to_sol
|
||||
end
|
||||
def test_method
|
||||
assert_equal Vool::ClassMethodExpression , @lst.class
|
||||
assert_equal Sol::ClassMethodExpression , @lst.class
|
||||
end
|
||||
def test_method_args
|
||||
assert_equal [:arg1, :arg2] , @lst.args
|
||||
end
|
||||
def test_body_is_scope_zero_statement
|
||||
assert_equal Vool::Statements , @lst.body.class
|
||||
assert_equal Sol::Statements , @lst.body.class
|
||||
end
|
||||
def test_body_is_scope_zero_statement
|
||||
assert_equal Vool::LocalAssignment , @lst.body.first.class
|
||||
assert_equal Sol::LocalAssignment , @lst.body.first.class
|
||||
end
|
||||
end
|
||||
class TestClassMethodStatementImplicitReturn < MiniTest::Test
|
||||
include RubyTests
|
||||
def setup()
|
||||
input = "def self.tryout(arg1, arg2) ; arg1 ; end "
|
||||
@lst = compile( input ).to_vool
|
||||
@lst = compile( input ).to_sol
|
||||
end
|
||||
def test_method
|
||||
assert_equal Vool::ClassMethodExpression , @lst.class
|
||||
assert_equal Sol::ClassMethodExpression , @lst.class
|
||||
end
|
||||
def test_method_args
|
||||
assert_equal [:arg1, :arg2] , @lst.args
|
||||
end
|
||||
def test_body_is_scope_zero_statement
|
||||
assert_equal Vool::ReturnStatement , @lst.body.class
|
||||
assert_equal Sol::ReturnStatement , @lst.body.class
|
||||
end
|
||||
end
|
||||
class TestClassMethodStatement < MiniTest::Test
|
||||
|
@ -1,24 +1,24 @@
|
||||
require_relative "helper"
|
||||
|
||||
module Ruby
|
||||
class TestClassStatementVool < MiniTest::Test
|
||||
class TestClassStatementSol < MiniTest::Test
|
||||
include RubyTests
|
||||
|
||||
def setup
|
||||
input = "class Tryout < Base;def meth; a = 5 ;end; end"
|
||||
@vool = compile( input ).to_vool
|
||||
@sol = compile( input ).to_sol
|
||||
end
|
||||
def test_class
|
||||
assert_equal Vool::ClassExpression , @vool.class
|
||||
assert_equal Sol::ClassExpression , @sol.class
|
||||
end
|
||||
def test_body
|
||||
assert_equal Vool::Statements , @vool.body.class
|
||||
assert_equal Sol::Statements , @sol.body.class
|
||||
end
|
||||
def test_compile_class_name
|
||||
assert_equal :Tryout , @vool.name
|
||||
assert_equal :Tryout , @sol.name
|
||||
end
|
||||
def test_compile_class_super
|
||||
assert_equal :Base , @vool.super_class_name
|
||||
assert_equal :Base , @sol.super_class_name
|
||||
end
|
||||
|
||||
end
|
||||
@ -63,15 +63,15 @@ module Ruby
|
||||
|
||||
def test_if
|
||||
input = "class Tryout < Base; false if(true) ; end"
|
||||
assert_raises_muted { compile( input ).to_vool}
|
||||
assert_raises_muted { compile( input ).to_sol}
|
||||
end
|
||||
def test_instance
|
||||
input = "class Tryout < Base; @var = 5 ; end"
|
||||
assert_raises_muted { compile( input ).to_vool}
|
||||
assert_raises_muted { compile( input ).to_sol}
|
||||
end
|
||||
def test_wrong_send
|
||||
input = "class Tryout < Base; hi() ; end"
|
||||
assert_raises_muted { compile( input ).to_vool}
|
||||
assert_raises_muted { compile( input ).to_sol}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -9,18 +9,18 @@ module Ruby
|
||||
end
|
||||
|
||||
def test_method_len
|
||||
assert_equal 2 , @vool.body.length , "setter, getter"
|
||||
assert_equal 2 , @sol.body.length , "setter, getter"
|
||||
end
|
||||
def test_setter
|
||||
assert_equal Vool::MethodExpression , setter.class
|
||||
assert_equal Sol::MethodExpression , setter.class
|
||||
end
|
||||
def test_setter_assign
|
||||
assert_equal Vool::Statements , setter.body.class
|
||||
assert_equal Vool::IvarAssignment , setter.body.first.class
|
||||
assert_equal Sol::Statements , setter.body.class
|
||||
assert_equal Sol::IvarAssignment , setter.body.first.class
|
||||
end
|
||||
def test_setter_return
|
||||
assert_equal Vool::Statements , setter.body.class
|
||||
assert_equal Vool::ReturnStatement , setter.body.last.class
|
||||
assert_equal Sol::Statements , setter.body.class
|
||||
assert_equal Sol::ReturnStatement , setter.body.last.class
|
||||
end
|
||||
def test_setter_name
|
||||
assert_equal :page= , setter.name
|
||||
@ -36,7 +36,7 @@ module Ruby
|
||||
"attr_reader :page"
|
||||
end
|
||||
def test_method_len
|
||||
assert_equal 1 , @vool.body.length , "setter, getter"
|
||||
assert_equal 1 , @sol.body.length , "setter, getter"
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -8,18 +8,18 @@ module Ruby
|
||||
"attr :page , :size"
|
||||
end
|
||||
def test_method_len
|
||||
assert_equal 4 , @vool.body.length , "2 setters, 2 getters"
|
||||
assert_equal 4 , @sol.body.length , "2 setters, 2 getters"
|
||||
end
|
||||
def test_setter
|
||||
assert_equal Vool::MethodExpression , setter.class
|
||||
assert_equal Sol::MethodExpression , setter.class
|
||||
end
|
||||
def test_setter_assign
|
||||
assert_equal Vool::Statements , setter.body.class
|
||||
assert_equal Vool::IvarAssignment , setter.body.first.class
|
||||
assert_equal Sol::Statements , setter.body.class
|
||||
assert_equal Sol::IvarAssignment , setter.body.first.class
|
||||
end
|
||||
def test_setter_return
|
||||
assert_equal Vool::Statements , setter.body.class
|
||||
assert_equal Vool::ReturnStatement , setter.body.last.class
|
||||
assert_equal Sol::Statements , setter.body.class
|
||||
assert_equal Sol::ReturnStatement , setter.body.last.class
|
||||
end
|
||||
def test_setter_name
|
||||
assert_equal :size= , setter.name
|
||||
|
@ -1,51 +1,51 @@
|
||||
require_relative 'helper'
|
||||
|
||||
module Ruby
|
||||
class TestIfStatementVool < MiniTest::Test
|
||||
class TestIfStatementSol < MiniTest::Test
|
||||
include RubyTests
|
||||
|
||||
def setup
|
||||
@lst = compile("if(true) ; a = 1 ; else ; a = 2 ; end").to_vool
|
||||
@lst = compile("if(true) ; a = 1 ; else ; a = 2 ; end").to_sol
|
||||
end
|
||||
def test_class
|
||||
assert_equal Vool::IfStatement , @lst.class
|
||||
assert_equal Sol::IfStatement , @lst.class
|
||||
end
|
||||
def test_true
|
||||
assert_equal Vool::LocalAssignment , @lst.if_true.class
|
||||
assert_equal Sol::LocalAssignment , @lst.if_true.class
|
||||
assert @lst.has_true?
|
||||
end
|
||||
def test_false
|
||||
assert_equal Vool::LocalAssignment , @lst.if_false.class
|
||||
assert_equal Sol::LocalAssignment , @lst.if_false.class
|
||||
assert @lst.has_false?
|
||||
end
|
||||
def test_condition
|
||||
assert_equal Vool::TrueConstant , @lst.condition.class
|
||||
assert_equal Sol::TrueConstant , @lst.condition.class
|
||||
end
|
||||
def test_to_s
|
||||
assert_tos "if (true);a = 1;else;a = 2;end" , @lst
|
||||
end
|
||||
end
|
||||
class TestIfStatementVoolHoisted < MiniTest::Test
|
||||
class TestIfStatementSolHoisted < MiniTest::Test
|
||||
include RubyTests
|
||||
|
||||
def setup
|
||||
@lst = compile("if(foo() == 1) ; a = 1 ; end").to_vool
|
||||
@lst = compile("if(foo() == 1) ; a = 1 ; end").to_sol
|
||||
end
|
||||
|
||||
def test_class
|
||||
assert_equal Vool::Statements , @lst.class
|
||||
assert_equal Sol::Statements , @lst.class
|
||||
end
|
||||
def test_first_class
|
||||
assert_equal Vool::LocalAssignment , @lst.first.class
|
||||
assert_equal Sol::LocalAssignment , @lst.first.class
|
||||
end
|
||||
def test_last_class
|
||||
assert_equal Vool::IfStatement , @lst.last.class
|
||||
assert_equal Sol::IfStatement , @lst.last.class
|
||||
end
|
||||
def test_true
|
||||
assert_equal Vool::LocalAssignment , @lst.last.if_true.class
|
||||
assert_equal Sol::LocalAssignment , @lst.last.if_true.class
|
||||
end
|
||||
def test_condition
|
||||
assert_equal Vool::SendStatement , @lst.last.condition.class
|
||||
assert_equal Sol::SendStatement , @lst.last.condition.class
|
||||
assert_equal :== , @lst.last.condition.name
|
||||
end
|
||||
end
|
||||
|
@ -25,13 +25,13 @@ module Ruby
|
||||
class TestPlusEquals < Minitest::Test
|
||||
include RubyTests
|
||||
def setup
|
||||
@lst = compile( "X.plus_equals(1)").to_vool
|
||||
@lst = compile( "X.plus_equals(1)").to_sol
|
||||
end
|
||||
def test_class
|
||||
assert_equal Vool::MacroExpression , @lst.class
|
||||
assert_equal Sol::MacroExpression , @lst.class
|
||||
end
|
||||
def test_arg1
|
||||
assert_equal Vool::IntegerConstant , @lst.arguments.first.class
|
||||
assert_equal Sol::IntegerConstant , @lst.arguments.first.class
|
||||
end
|
||||
def test_name
|
||||
assert_equal :plus_equals , @lst.name
|
||||
@ -40,22 +40,22 @@ module Ruby
|
||||
class TestPlusEqualsX < Minitest::Test
|
||||
include RubyTests
|
||||
def setup
|
||||
@lst = compile_main( "X.plus_equals(arg,1)").to_vool
|
||||
@lst = compile_main( "X.plus_equals(arg,1)").to_sol
|
||||
end
|
||||
def method_body
|
||||
@lst.body.first.body
|
||||
end
|
||||
def test_class
|
||||
assert_equal Vool::ClassExpression , @lst.class
|
||||
assert_equal Vool::MethodExpression , @lst.body.first.class
|
||||
assert_equal Sol::ClassExpression , @lst.class
|
||||
assert_equal Sol::MethodExpression , @lst.body.first.class
|
||||
end
|
||||
def test_macro_class
|
||||
assert_equal Vool::ReturnStatement , method_body.class
|
||||
assert_equal Vool::MacroExpression , method_body.return_value.class
|
||||
assert_equal Sol::ReturnStatement , method_body.class
|
||||
assert_equal Sol::MacroExpression , method_body.return_value.class
|
||||
end
|
||||
def test_args
|
||||
assert_equal Vool::LocalVariable , method_body.return_value.arguments.first.class
|
||||
assert_equal Vool::IntegerConstant , method_body.return_value.arguments.last.class
|
||||
assert_equal Sol::LocalVariable , method_body.return_value.arguments.first.class
|
||||
assert_equal Sol::IntegerConstant , method_body.return_value.arguments.last.class
|
||||
end
|
||||
def test_name
|
||||
assert_equal :plus_equals , method_body.return_value.name
|
||||
|
@ -7,47 +7,47 @@ module Ruby
|
||||
class TestMethodStatementRet < MiniTest::Test
|
||||
include RubyTests
|
||||
def test_single_const
|
||||
@lst = compile( "def tryout(arg1, arg2) ; true ; end " ).to_vool
|
||||
assert_equal Vool::ReturnStatement , @lst.body.class
|
||||
@lst = compile( "def tryout(arg1, arg2) ; true ; end " ).to_sol
|
||||
assert_equal Sol::ReturnStatement , @lst.body.class
|
||||
end
|
||||
def test_single_instance
|
||||
@lst = compile( "def tryout(arg1, arg2) ; @a ; end " ).to_vool
|
||||
assert_equal Vool::ReturnStatement , @lst.body.class
|
||||
@lst = compile( "def tryout(arg1, arg2) ; @a ; end " ).to_sol
|
||||
assert_equal Sol::ReturnStatement , @lst.body.class
|
||||
end
|
||||
def test_single_call
|
||||
@lst = compile( "def tryout(arg1, arg2) ; is_true() ; end " ).to_vool
|
||||
assert_equal Vool::ReturnStatement , @lst.body.class
|
||||
@lst = compile( "def tryout(arg1, arg2) ; is_true() ; end " ).to_sol
|
||||
assert_equal Sol::ReturnStatement , @lst.body.class
|
||||
end
|
||||
|
||||
def test_multi_const
|
||||
@lst = compile( "def tryout(arg1, arg2) ; @a = some_call(); true ; end " ).to_vool
|
||||
assert_equal Vool::ReturnStatement , @lst.body.last.class
|
||||
@lst = compile( "def tryout(arg1, arg2) ; @a = some_call(); true ; end " ).to_sol
|
||||
assert_equal Sol::ReturnStatement , @lst.body.last.class
|
||||
end
|
||||
def test_multi_instance
|
||||
@lst = compile( "def tryout(arg1, arg2) ; @a = some_call(); @a ; end " ).to_vool
|
||||
assert_equal Vool::ReturnStatement , @lst.body.last.class
|
||||
@lst = compile( "def tryout(arg1, arg2) ; @a = some_call(); @a ; end " ).to_sol
|
||||
assert_equal Sol::ReturnStatement , @lst.body.last.class
|
||||
end
|
||||
def test_multi_call
|
||||
@lst = compile( "def tryout(arg1, arg2) ; is_true() ; some_call() ; end " ).to_vool
|
||||
assert_equal Vool::ReturnStatement , @lst.body.last.class
|
||||
@lst = compile( "def tryout(arg1, arg2) ; is_true() ; some_call() ; end " ).to_sol
|
||||
assert_equal Sol::ReturnStatement , @lst.body.last.class
|
||||
end
|
||||
|
||||
def test_return
|
||||
@lst = compile( "def tryout(arg1, arg2) ; return 1 ; end " ).to_vool
|
||||
assert_equal Vool::ReturnStatement , @lst.body.class
|
||||
assert_equal Vool::IntegerConstant , @lst.body.return_value.class
|
||||
@lst = compile( "def tryout(arg1, arg2) ; return 1 ; end " ).to_sol
|
||||
assert_equal Sol::ReturnStatement , @lst.body.class
|
||||
assert_equal Sol::IntegerConstant , @lst.body.return_value.class
|
||||
end
|
||||
def test_local_assign
|
||||
@lst = compile( "def tryout(arg1, arg2) ; a = 1 ; end " ).to_vool
|
||||
assert_equal Vool::Statements , @lst.body.class
|
||||
assert_equal Vool::ReturnStatement , @lst.body.last.class
|
||||
assert_equal Vool::LocalVariable , @lst.body.last.return_value.class
|
||||
@lst = compile( "def tryout(arg1, arg2) ; a = 1 ; end " ).to_sol
|
||||
assert_equal Sol::Statements , @lst.body.class
|
||||
assert_equal Sol::ReturnStatement , @lst.body.last.class
|
||||
assert_equal Sol::LocalVariable , @lst.body.last.return_value.class
|
||||
end
|
||||
def test_local_assign
|
||||
@lst = compile( "def tryout(arg1, arg2) ; @a = 1 ; end " ).to_vool
|
||||
assert_equal Vool::Statements , @lst.body.class
|
||||
assert_equal Vool::ReturnStatement , @lst.body.last.class
|
||||
assert_equal Vool::InstanceVariable , @lst.body.last.return_value.class
|
||||
@lst = compile( "def tryout(arg1, arg2) ; @a = 1 ; end " ).to_sol
|
||||
assert_equal Sol::Statements , @lst.body.class
|
||||
assert_equal Sol::ReturnStatement , @lst.body.last.class
|
||||
assert_equal Sol::InstanceVariable , @lst.body.last.return_value.class
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -4,30 +4,30 @@ module Ruby
|
||||
class TestSendRequireHelper < MiniTest::Test
|
||||
include RubyTests
|
||||
def setup
|
||||
@lst = compile( "require_relative 'helper'").to_vool
|
||||
@lst = compile( "require_relative 'helper'").to_sol
|
||||
end
|
||||
def test_helper_class
|
||||
assert_equal Vool::ClassExpression , @lst.class
|
||||
assert_equal Sol::ClassExpression , @lst.class
|
||||
assert_equal :ParfaitTest , @lst.name
|
||||
end
|
||||
def test_methods
|
||||
assert_equal Vool::Statements , @lst.body.class
|
||||
assert_equal Vool::MethodExpression , @lst.body.first.class
|
||||
assert_equal Sol::Statements , @lst.body.class
|
||||
assert_equal Sol::MethodExpression , @lst.body.first.class
|
||||
assert_equal :setup , @lst.body.first.name
|
||||
end
|
||||
end
|
||||
class TestSendRequireparfait < MiniTest::Test
|
||||
include RubyTests
|
||||
def setup
|
||||
@lst = compile( "require_relative 'object'").to_vool
|
||||
@lst = compile( "require_relative 'object'").to_sol
|
||||
end
|
||||
def test_helper_class
|
||||
assert_equal Vool::ClassExpression , @lst.class
|
||||
assert_equal Sol::ClassExpression , @lst.class
|
||||
assert_equal :Object , @lst.name
|
||||
end
|
||||
def test_methods
|
||||
assert_equal Vool::Statements , @lst.body.class
|
||||
assert_equal Vool::MethodExpression , @lst.body.first.class
|
||||
assert_equal Sol::Statements , @lst.body.class
|
||||
assert_equal Sol::MethodExpression , @lst.body.first.class
|
||||
assert_equal :type , @lst.body.first.name
|
||||
end
|
||||
end
|
||||
|
@ -21,30 +21,30 @@ module Ruby
|
||||
end
|
||||
|
||||
end
|
||||
class TestReturnStatementVool < MiniTest::Test
|
||||
class TestReturnStatementSol < MiniTest::Test
|
||||
include RubyTests
|
||||
|
||||
def test_return_const
|
||||
lst = compile( "return 1" ).to_vool
|
||||
assert_equal Vool::ReturnStatement , lst.class
|
||||
lst = compile( "return 1" ).to_sol
|
||||
assert_equal Sol::ReturnStatement , lst.class
|
||||
end
|
||||
def test_return_value
|
||||
lst = compile( "return 1" ).to_vool
|
||||
lst = compile( "return 1" ).to_sol
|
||||
assert_equal 1 , lst.return_value.value
|
||||
end
|
||||
|
||||
def test_return_send
|
||||
lst = compile( "return foo" ).to_vool
|
||||
assert_equal Vool::ReturnStatement , lst.class
|
||||
lst = compile( "return foo" ).to_sol
|
||||
assert_equal Sol::ReturnStatement , lst.class
|
||||
end
|
||||
def test_return_send3
|
||||
lst = compile( "return foo.bar.zoo" ).to_vool
|
||||
assert_equal Vool::LocalAssignment , lst.first.class
|
||||
lst = compile( "return foo.bar.zoo" ).to_sol
|
||||
assert_equal Sol::LocalAssignment , lst.first.class
|
||||
assert lst.first.name.to_s.start_with?("tmp_")
|
||||
end
|
||||
def test_return_send4
|
||||
lst = compile( "return foo.bar.zoo" ).to_vool
|
||||
assert_equal Vool::ReturnStatement, lst[2].class
|
||||
lst = compile( "return foo.bar.zoo" ).to_sol
|
||||
assert_equal Sol::ReturnStatement, lst[2].class
|
||||
assert_equal :zoo, lst[2].return_value.name
|
||||
end
|
||||
end
|
||||
|
@ -25,22 +25,22 @@ module Ruby
|
||||
assert_equal 1 , @lst.body.arguments.length
|
||||
end
|
||||
end
|
||||
class TestBlockStatementVool < MiniTest::Test
|
||||
class TestBlockStatementSol < MiniTest::Test
|
||||
include RubyTests
|
||||
|
||||
def setup()
|
||||
input = "plus_one{|arg1| arg1 + 1 } "
|
||||
@lst = compile( input ).to_vool
|
||||
@lst = compile( input ).to_sol
|
||||
end
|
||||
def test_block
|
||||
assert_equal Vool::SendStatement , @lst.class
|
||||
assert_equal Sol::SendStatement , @lst.class
|
||||
end
|
||||
def test_send_name
|
||||
assert_equal :plus_one , @lst.name
|
||||
end
|
||||
def test_send_block_arg
|
||||
assert_equal 1 , @lst.arguments.length
|
||||
assert_equal Vool::LambdaExpression , @lst.arguments.first.class
|
||||
assert_equal Sol::LambdaExpression , @lst.arguments.first.class
|
||||
end
|
||||
def test_block_args
|
||||
assert_equal [:arg1] , @lst.arguments.first.args
|
||||
|
@ -24,28 +24,28 @@ module Ruby
|
||||
assert_equal ReturnStatement , @lst.last.class
|
||||
end
|
||||
end
|
||||
class TestBlockReturnVool < MiniTest::Test
|
||||
class TestBlockReturnSol < MiniTest::Test
|
||||
include RubyTests
|
||||
def setup()
|
||||
input = "a = plus_one{return 1 } ; return a "
|
||||
@lst = compile( input ).to_vool
|
||||
@lst = compile( input ).to_sol
|
||||
end
|
||||
def test_scope
|
||||
assert_equal Vool::ScopeStatement , @lst.class
|
||||
assert_equal Sol::ScopeStatement , @lst.class
|
||||
end
|
||||
def test_assign
|
||||
assert_equal Vool::LocalAssignment , @lst.first.class
|
||||
assert_equal Sol::LocalAssignment , @lst.first.class
|
||||
assert_equal :a , @lst.first.name
|
||||
end
|
||||
def test_send
|
||||
assert_equal Vool::SendStatement , @lst.first.value.class
|
||||
assert_equal Sol::SendStatement , @lst.first.value.class
|
||||
assert_equal :plus_one , @lst.first.value.name
|
||||
end
|
||||
def test_block_arg
|
||||
assert_equal Vool::LambdaExpression , @lst.first.value.arguments.first.class
|
||||
assert_equal Sol::LambdaExpression , @lst.first.value.arguments.first.class
|
||||
end
|
||||
def test_ret
|
||||
assert_equal Vool::ReturnStatement , @lst[1].class
|
||||
assert_equal Sol::ReturnStatement , @lst[1].class
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,69 +1,69 @@
|
||||
require_relative "helper"
|
||||
|
||||
module Ruby
|
||||
class TestSendNoArgVool < MiniTest::Test
|
||||
class TestSendNoArgSol < MiniTest::Test
|
||||
include RubyTests
|
||||
def setup
|
||||
@lst = compile( "foo").to_vool
|
||||
@lst = compile( "foo").to_sol
|
||||
end
|
||||
def test_simple_class
|
||||
assert_equal Vool::SendStatement , @lst.class
|
||||
assert_equal Sol::SendStatement , @lst.class
|
||||
end
|
||||
def test_simple_name
|
||||
assert_equal :foo , @lst.name
|
||||
end
|
||||
def test_simple_receiver
|
||||
assert_equal Vool::SelfExpression , @lst.receiver.class
|
||||
assert_equal Sol::SelfExpression , @lst.receiver.class
|
||||
end
|
||||
def test_simple_args
|
||||
assert_equal [] , @lst.arguments
|
||||
end
|
||||
end
|
||||
class TestSendSimpleArgVool < MiniTest::Test
|
||||
class TestSendSimpleArgSol < MiniTest::Test
|
||||
include RubyTests
|
||||
def setup
|
||||
@lst = compile( "bar(1)").to_vool
|
||||
@lst = compile( "bar(1)").to_sol
|
||||
end
|
||||
def test_class
|
||||
assert_equal Vool::SendStatement , @lst.class
|
||||
assert_equal Sol::SendStatement , @lst.class
|
||||
end
|
||||
def test_name
|
||||
assert_equal :bar , @lst.name
|
||||
end
|
||||
def test_receiver
|
||||
assert_equal Vool::SelfExpression , @lst.receiver.class
|
||||
assert_equal Sol::SelfExpression , @lst.receiver.class
|
||||
end
|
||||
def test_args
|
||||
assert_equal Vool::IntegerConstant , @lst.arguments.first.class
|
||||
assert_equal Sol::IntegerConstant , @lst.arguments.first.class
|
||||
end
|
||||
end
|
||||
class TestSendSuperVool < MiniTest::Test
|
||||
class TestSendSuperSol < MiniTest::Test
|
||||
include RubyTests
|
||||
def test_super0
|
||||
lst = compile( "super").to_vool
|
||||
assert_equal Vool::SuperStatement , lst.class
|
||||
lst = compile( "super").to_sol
|
||||
assert_equal Sol::SuperStatement , lst.class
|
||||
end
|
||||
def test_super0_receiver
|
||||
lst = compile( "super").to_vool
|
||||
assert_equal Vool::SelfExpression , lst.receiver.class
|
||||
lst = compile( "super").to_sol
|
||||
assert_equal Sol::SelfExpression , lst.receiver.class
|
||||
end
|
||||
end
|
||||
class TestSendSuperArgsVool < MiniTest::Test
|
||||
class TestSendSuperArgsSol < MiniTest::Test
|
||||
include RubyTests
|
||||
def setup
|
||||
@lst = compile( "super(1)").to_vool
|
||||
@lst = compile( "super(1)").to_sol
|
||||
end
|
||||
def test_super_class
|
||||
assert_equal Vool::SuperStatement , @lst.class
|
||||
assert_equal Sol::SuperStatement , @lst.class
|
||||
end
|
||||
def test_super_receiver
|
||||
assert_equal Vool::SelfExpression , @lst.receiver.class
|
||||
assert_equal Sol::SelfExpression , @lst.receiver.class
|
||||
end
|
||||
def test_super_name
|
||||
assert_equal :super, @lst.name
|
||||
end
|
||||
end
|
||||
class TestSendReceiverTypeVool < MiniTest::Test
|
||||
class TestSendReceiverTypeSol < MiniTest::Test
|
||||
include RubyTests
|
||||
|
||||
def setup
|
||||
@ -71,12 +71,12 @@ module Ruby
|
||||
end
|
||||
|
||||
def test_int_receiver
|
||||
sent = compile( "5.div4").to_vool
|
||||
sent = compile( "5.div4").to_sol
|
||||
assert_equal Parfait::Type , sent.receiver.ct_type.class
|
||||
assert_equal "Integer_Type" , sent.receiver.ct_type.name
|
||||
end
|
||||
def test_string_receiver
|
||||
sent = compile( "'5'.putstring").to_vool
|
||||
sent = compile( "'5'.putstring").to_sol
|
||||
assert_equal Parfait::Type , sent.receiver.ct_type.class
|
||||
assert_equal "Word_Type" , sent.receiver.ct_type.name
|
||||
end
|
||||
@ -84,13 +84,13 @@ module Ruby
|
||||
class TestSendReceiver < MiniTest::Test
|
||||
include RubyTests
|
||||
def setup
|
||||
@lst = compile( "call.once.more").to_vool
|
||||
@lst = compile( "call.once.more").to_sol
|
||||
end
|
||||
def test_class
|
||||
assert_equal Vool::Statements , @lst.class
|
||||
assert_equal Sol::Statements , @lst.class
|
||||
end
|
||||
def test_one
|
||||
assert_equal Vool::LocalAssignment , @lst.first.class
|
||||
assert_equal Sol::LocalAssignment , @lst.first.class
|
||||
end
|
||||
def test_one_name
|
||||
assert @lst[0].name.to_s.start_with?("tmp_")
|
||||
@ -105,7 +105,7 @@ module Ruby
|
||||
assert_equal :once , @lst[1].value.name
|
||||
end
|
||||
def test_three_class
|
||||
assert_equal Vool::SendStatement, @lst[2].class
|
||||
assert_equal Sol::SendStatement, @lst[2].class
|
||||
end
|
||||
def test_three_name
|
||||
assert_equal :more , @lst[2].name
|
||||
|
@ -4,67 +4,67 @@ module Ruby
|
||||
module LastBar
|
||||
include RubyTests
|
||||
def test_last_class
|
||||
assert_equal Vool::SendStatement , @lst.last.class
|
||||
assert_equal Sol::SendStatement , @lst.last.class
|
||||
end
|
||||
def test_last_name
|
||||
assert_equal :last , @lst.last.name
|
||||
end
|
||||
def test_last_arg
|
||||
assert_equal Vool::LocalVariable , @lst.last.arguments.first.class
|
||||
assert_equal Sol::LocalVariable , @lst.last.arguments.first.class
|
||||
end
|
||||
def test_lst_class
|
||||
assert_equal Vool::Statements , @lst.class
|
||||
assert_equal Sol::Statements , @lst.class
|
||||
end
|
||||
def test_lst_no_statements
|
||||
@lst.statements.each{|st| assert( ! st.is_a?(Vool::Statements) , st.class)}
|
||||
@lst.statements.each{|st| assert( ! st.is_a?(Sol::Statements) , st.class)}
|
||||
end
|
||||
end
|
||||
class TestSendSendArgVool < MiniTest::Test
|
||||
class TestSendSendArgSol < MiniTest::Test
|
||||
include LastBar
|
||||
def setup
|
||||
@lst = compile( "last(foo(1))").to_vool
|
||||
@lst = compile( "last(foo(1))").to_sol
|
||||
end
|
||||
def test_classes
|
||||
assert_equal Vool::Statements , @lst.class
|
||||
assert_equal Vool::LocalAssignment , @lst.first.class
|
||||
assert_equal Vool::SendStatement , @lst.last.class
|
||||
assert_equal Sol::Statements , @lst.class
|
||||
assert_equal Sol::LocalAssignment , @lst.first.class
|
||||
assert_equal Sol::SendStatement , @lst.last.class
|
||||
end
|
||||
def test_foo1
|
||||
assert_equal Vool::SendStatement , @lst.first.value.class
|
||||
assert_equal Sol::SendStatement , @lst.first.value.class
|
||||
assert_equal :foo , @lst.first.value.name
|
||||
assert_equal Vool::IntegerConstant , @lst.first.value.arguments.first.class
|
||||
assert_equal Sol::IntegerConstant , @lst.first.value.arguments.first.class
|
||||
end
|
||||
end
|
||||
class Test3SendVool < MiniTest::Test
|
||||
class Test3SendSol < MiniTest::Test
|
||||
include LastBar
|
||||
def setup
|
||||
@lst = compile( "last(foo(more(1)))").to_vool
|
||||
@lst = compile( "last(foo(more(1)))").to_sol
|
||||
end
|
||||
def test_classes
|
||||
assert_equal Vool::Statements , @lst.class
|
||||
assert_equal Vool::LocalAssignment , @lst.first.class
|
||||
assert_equal Vool::SendStatement , @lst.last.class
|
||||
assert_equal Sol::Statements , @lst.class
|
||||
assert_equal Sol::LocalAssignment , @lst.first.class
|
||||
assert_equal Sol::SendStatement , @lst.last.class
|
||||
end
|
||||
def test_foo
|
||||
assert_equal Vool::SendStatement , @lst.first.value.class
|
||||
assert_equal Sol::SendStatement , @lst.first.value.class
|
||||
assert_equal :more , @lst.first.value.name
|
||||
assert_equal Vool::IntegerConstant , @lst.first.value.arguments.first.class
|
||||
assert_equal Sol::IntegerConstant , @lst.first.value.arguments.first.class
|
||||
end
|
||||
end
|
||||
class Test5SendVool < MiniTest::Test
|
||||
class Test5SendSol < MiniTest::Test
|
||||
include LastBar
|
||||
def setup
|
||||
@lst = compile( "last(foo(more(even_more(1),and_more(with_more))))").to_vool
|
||||
@lst = compile( "last(foo(more(even_more(1),and_more(with_more))))").to_sol
|
||||
end
|
||||
def test_classes
|
||||
assert_equal Vool::Statements , @lst.class
|
||||
assert_equal Vool::LocalAssignment , @lst.first.class
|
||||
assert_equal Vool::SendStatement , @lst.last.class
|
||||
assert_equal Sol::Statements , @lst.class
|
||||
assert_equal Sol::LocalAssignment , @lst.first.class
|
||||
assert_equal Sol::SendStatement , @lst.last.class
|
||||
end
|
||||
def test_foo
|
||||
assert_equal Vool::SendStatement , @lst.first.value.class
|
||||
assert_equal Sol::SendStatement , @lst.first.value.class
|
||||
assert_equal :even_more , @lst.first.value.name
|
||||
assert_equal Vool::IntegerConstant , @lst.first.value.arguments.first.class
|
||||
assert_equal Sol::IntegerConstant , @lst.first.value.arguments.first.class
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -8,15 +8,15 @@ module Ruby
|
||||
assert_equal "Statement" , Statement.new.class_name
|
||||
end
|
||||
def test_brother
|
||||
assert_equal Vool::Statement , Statement.new.vool_brother
|
||||
assert_equal Sol::Statement , Statement.new.sol_brother
|
||||
end
|
||||
def test_yield
|
||||
lst = compile( "yield")
|
||||
assert_equal Vool::YieldStatement , lst.vool_brother
|
||||
assert_equal Sol::YieldStatement , lst.sol_brother
|
||||
end
|
||||
def test_assign
|
||||
lst = compile( "a = 4")
|
||||
assert_equal Vool::LocalAssignment , lst.vool_brother
|
||||
assert_equal Sol::LocalAssignment , lst.sol_brother
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -52,38 +52,38 @@ module Ruby
|
||||
assert_equal :Module , lst.name
|
||||
end
|
||||
end
|
||||
class TestVariablesVool < MiniTest::Test
|
||||
class TestVariablesSol < MiniTest::Test
|
||||
include RubyTests
|
||||
def test_local_basic
|
||||
lst = compile( "foo = 1 ; return foo").to_vool
|
||||
assert_equal Vool::LocalVariable , lst.statements[1].return_value.class
|
||||
lst = compile( "foo = 1 ; return foo").to_sol
|
||||
assert_equal Sol::LocalVariable , lst.statements[1].return_value.class
|
||||
end
|
||||
|
||||
def test_instance_basic
|
||||
lst = compile( "@var" ).to_vool
|
||||
assert_equal Vool::InstanceVariable , lst.class
|
||||
lst = compile( "@var" ).to_sol
|
||||
assert_equal Sol::InstanceVariable , lst.class
|
||||
assert_equal :var , lst.name
|
||||
end
|
||||
|
||||
def test_instance_return
|
||||
lst = compile( "return @var" ).to_vool
|
||||
assert_equal Vool::InstanceVariable , lst.return_value.class
|
||||
lst = compile( "return @var" ).to_sol
|
||||
assert_equal Sol::InstanceVariable , lst.return_value.class
|
||||
end
|
||||
|
||||
def test_class_basic
|
||||
lst = compile( "@@var" ).to_vool
|
||||
assert_equal Vool::ClassVariable , lst.class
|
||||
lst = compile( "@@var" ).to_sol
|
||||
assert_equal Sol::ClassVariable , lst.class
|
||||
assert_equal :var , lst.name
|
||||
end
|
||||
|
||||
def test_class_return
|
||||
lst = compile( "return @@var" ).to_vool
|
||||
assert_equal Vool::ClassVariable , lst.return_value.class
|
||||
lst = compile( "return @@var" ).to_sol
|
||||
assert_equal Sol::ClassVariable , lst.return_value.class
|
||||
end
|
||||
|
||||
def test_module_basic
|
||||
lst = compile( "Module" ).to_vool
|
||||
assert_equal Vool::ModuleName , lst.class
|
||||
lst = compile( "Module" ).to_sol
|
||||
assert_equal Sol::ModuleName , lst.class
|
||||
assert_equal :Module , lst.name
|
||||
end
|
||||
|
||||
|
@ -1,19 +1,19 @@
|
||||
require_relative 'helper'
|
||||
|
||||
module Ruby
|
||||
class TestWhileStatementVool < MiniTest::Test
|
||||
class TestWhileStatementSol < MiniTest::Test
|
||||
include RubyTests
|
||||
def setup
|
||||
@lst = compile( "while(@arg) ; @arg = 1 ; end" ).to_vool
|
||||
@lst = compile( "while(@arg) ; @arg = 1 ; end" ).to_sol
|
||||
end
|
||||
def test_class
|
||||
assert_equal Vool::WhileStatement , @lst.class
|
||||
assert_equal Sol::WhileStatement , @lst.class
|
||||
end
|
||||
def test_body_class
|
||||
assert_equal Vool::IvarAssignment , @lst.body.class
|
||||
assert_equal Sol::IvarAssignment , @lst.body.class
|
||||
end
|
||||
def test_condition_class
|
||||
assert_equal Vool::InstanceVariable , @lst.condition.class
|
||||
assert_equal Sol::InstanceVariable , @lst.condition.class
|
||||
end
|
||||
def test_no_hoist
|
||||
assert_nil @lst.hoisted
|
||||
@ -22,20 +22,20 @@ module Ruby
|
||||
class TestWhileStatementHoist < MiniTest::Test
|
||||
include RubyTests
|
||||
def setup
|
||||
@lst = compile( "while(call(arg > 1)) ; arg = 1 ; end" ).to_vool
|
||||
@lst = compile( "while(call(arg > 1)) ; arg = 1 ; end" ).to_sol
|
||||
end
|
||||
def test_class
|
||||
assert_equal Vool::WhileStatement , @lst.class
|
||||
assert_equal Vool::LocalAssignment , @lst.body.class
|
||||
assert_equal Sol::WhileStatement , @lst.class
|
||||
assert_equal Sol::LocalAssignment , @lst.body.class
|
||||
end
|
||||
def test_condition_class
|
||||
assert_equal Vool::SendStatement , @lst.condition.class
|
||||
assert_equal Sol::SendStatement , @lst.condition.class
|
||||
end
|
||||
def test_hoist
|
||||
assert_equal Vool::Statements , @lst.hoisted.class
|
||||
assert_equal Sol::Statements , @lst.hoisted.class
|
||||
end
|
||||
def test_hoist_is_assi
|
||||
assert_equal Vool::LocalAssignment , @lst.hoisted.first.class
|
||||
assert_equal Sol::LocalAssignment , @lst.hoisted.first.class
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -18,18 +18,18 @@ module Ruby
|
||||
assert_equal "yield(0)" , @lst.to_s
|
||||
end
|
||||
end
|
||||
class TestYieldStatementVool < MiniTest::Test
|
||||
class TestYieldStatementSol < MiniTest::Test
|
||||
include RubyTests
|
||||
|
||||
def setup()
|
||||
input = "yield(0)"
|
||||
@lst = compile( input ).to_vool
|
||||
@lst = compile( input ).to_sol
|
||||
end
|
||||
def test_block
|
||||
assert_equal Vool::YieldStatement , @lst.class
|
||||
assert_equal Sol::YieldStatement , @lst.class
|
||||
end
|
||||
def test_block_args
|
||||
assert_equal Vool::IntegerConstant , @lst.arguments.first.class
|
||||
assert_equal Sol::IntegerConstant , @lst.arguments.first.class
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user