2018-07-20 09:05:11 +02:00
|
|
|
require_relative "helper"
|
|
|
|
|
|
|
|
module Ruby
|
|
|
|
class TestSendFooVool < MiniTest::Test
|
|
|
|
include RubyTests
|
|
|
|
def setup
|
|
|
|
@lst = compile( "foo").to_vool
|
|
|
|
end
|
|
|
|
def test_simple_class
|
|
|
|
assert_equal Vool::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
|
|
|
|
end
|
|
|
|
def test_simple_args
|
|
|
|
assert_equal [] , @lst.arguments
|
|
|
|
end
|
|
|
|
end
|
|
|
|
class TestSendBarVool < MiniTest::Test
|
|
|
|
include RubyTests
|
|
|
|
def setup
|
|
|
|
@lst = compile( "bar(1)").to_vool
|
|
|
|
end
|
|
|
|
def test_class
|
2018-07-20 12:15:16 +02:00
|
|
|
assert_equal Vool::SendStatement , @lst.class
|
2018-07-20 09:05:11 +02:00
|
|
|
end
|
|
|
|
def test_name
|
2018-07-20 12:15:16 +02:00
|
|
|
assert_equal :bar , @lst.name
|
2018-07-20 09:05:11 +02:00
|
|
|
end
|
|
|
|
def test_receiver
|
2018-07-20 12:15:16 +02:00
|
|
|
assert_equal Vool::SelfExpression , @lst.receiver.class
|
2018-07-20 09:05:11 +02:00
|
|
|
end
|
|
|
|
def test_args
|
2018-07-20 12:15:16 +02:00
|
|
|
assert_equal Vool::IntegerConstant , @lst.arguments.first.class
|
2018-07-20 09:05:11 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
class TestSendSuperVool < MiniTest::Test
|
|
|
|
include RubyTests
|
|
|
|
def test_super0_receiver
|
|
|
|
lst = compile( "super").to_vool
|
|
|
|
assert_equal Vool::SuperExpression , lst.receiver.class
|
|
|
|
end
|
|
|
|
def test_super0
|
|
|
|
lst = compile( "super").to_vool
|
|
|
|
assert_equal Vool::SendStatement , lst.class
|
|
|
|
end
|
|
|
|
end
|
|
|
|
class TestSendSuperArgsVool < MiniTest::Test
|
|
|
|
include RubyTests
|
|
|
|
def setup
|
|
|
|
@lst = compile( "super(1)").to_vool
|
|
|
|
end
|
2018-07-20 12:15:16 +02:00
|
|
|
def test_super_class
|
|
|
|
assert_equal Vool::SendStatement , @lst.class
|
2018-07-20 09:05:11 +02:00
|
|
|
end
|
|
|
|
def test_super_receiver
|
2018-07-20 12:15:16 +02:00
|
|
|
assert_equal Vool::SuperExpression , @lst.receiver.class
|
2018-07-20 09:05:11 +02:00
|
|
|
end
|
|
|
|
def test_super_name #is nil
|
2018-07-20 12:15:16 +02:00
|
|
|
assert_nil @lst.name
|
2018-07-20 09:05:11 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
class TestSendReceiverTypeVool < MiniTest::Test
|
|
|
|
include RubyTests
|
|
|
|
|
|
|
|
def setup
|
2019-02-08 22:03:23 +01:00
|
|
|
Parfait.boot!(Parfait.default_test_options)
|
2018-07-20 09:05:11 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_int_receiver
|
|
|
|
sent = compile( "5.div4").to_vool
|
|
|
|
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
|
|
|
|
assert_equal Parfait::Type , sent.receiver.ct_type.class
|
|
|
|
assert_equal "Word_Type" , sent.receiver.ct_type.name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|