2017-04-02 18:13:14 +02:00
|
|
|
require_relative "helper"
|
2017-04-02 11:59:07 +02:00
|
|
|
|
2018-07-19 13:46:51 +02:00
|
|
|
module Ruby
|
2018-07-20 12:43:37 +02:00
|
|
|
class TestAssignment < MiniTest::Test
|
2018-06-29 21:46:39 +02:00
|
|
|
include RubyTests
|
2017-04-02 11:59:07 +02:00
|
|
|
|
|
|
|
def test_local
|
2018-06-29 21:46:39 +02:00
|
|
|
lst = compile( "foo = bar")
|
2017-04-02 11:59:07 +02:00
|
|
|
assert_equal LocalAssignment , lst.class
|
|
|
|
end
|
|
|
|
def test_local_name
|
2018-06-29 21:46:39 +02:00
|
|
|
lst = compile( "foo = bar")
|
2017-04-02 11:59:07 +02:00
|
|
|
assert_equal :foo , lst.name
|
|
|
|
end
|
2017-04-04 17:10:28 +02:00
|
|
|
def test_instance
|
2018-06-29 21:46:39 +02:00
|
|
|
lst = compile( "@foo = bar")
|
2017-04-12 19:29:45 +02:00
|
|
|
assert_equal IvarAssignment , lst.class
|
2017-04-04 17:10:28 +02:00
|
|
|
end
|
|
|
|
def test_instance_name
|
2018-06-29 21:46:39 +02:00
|
|
|
lst = compile( "@foo = bar")
|
2017-04-04 17:10:28 +02:00
|
|
|
assert_equal :foo , lst.name
|
|
|
|
end
|
2017-09-10 12:33:32 +02:00
|
|
|
def test_const
|
2018-06-29 21:46:39 +02:00
|
|
|
lst = compile( "@foo = 5")
|
2017-09-10 12:33:32 +02:00
|
|
|
assert_equal IvarAssignment , lst.class
|
|
|
|
end
|
2018-07-20 12:43:37 +02:00
|
|
|
end
|
2018-07-20 17:13:58 +02:00
|
|
|
class TestAssignmentVoolBar < MiniTest::Test
|
2018-07-20 12:43:37 +02:00
|
|
|
include RubyTests
|
2018-07-20 17:13:58 +02:00
|
|
|
def setup
|
|
|
|
@lst = compile( "foo = bar").to_vool
|
|
|
|
end
|
2018-07-20 12:43:37 +02:00
|
|
|
def test_local
|
2018-07-20 17:13:58 +02:00
|
|
|
assert_equal Vool::LocalAssignment , @lst.class
|
|
|
|
end
|
|
|
|
def test_bar
|
|
|
|
assert_equal Vool::SendStatement , @lst.value.class
|
2018-07-20 12:43:37 +02:00
|
|
|
end
|
|
|
|
def test_local_name
|
2018-07-20 17:13:58 +02:00
|
|
|
assert_equal :foo , @lst.name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
class TestAssignmentVoolInst < MiniTest::Test
|
|
|
|
include RubyTests
|
|
|
|
def setup
|
|
|
|
@lst = compile( "@foo = bar").to_vool
|
2018-07-20 12:43:37 +02:00
|
|
|
end
|
|
|
|
def test_instance
|
2018-07-20 17:13:58 +02:00
|
|
|
assert_equal Vool::IvarAssignment , @lst.class
|
2018-07-20 12:43:37 +02:00
|
|
|
end
|
|
|
|
def test_instance_name
|
2018-07-20 17:13:58 +02:00
|
|
|
assert_equal :foo , @lst.name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
class TestAssignmentVoolConst < MiniTest::Test
|
|
|
|
include RubyTests
|
|
|
|
def setup
|
|
|
|
@lst = compile( "foo = 5").to_vool
|
2018-07-20 12:43:37 +02:00
|
|
|
end
|
|
|
|
def test_const
|
2018-07-20 17:13:58 +02:00
|
|
|
assert_equal Vool::IntegerConstant , @lst.value.class
|
2018-07-20 12:43:37 +02:00
|
|
|
end
|
2017-04-02 11:59:07 +02:00
|
|
|
end
|
|
|
|
end
|