2018-06-25 15:32:20 +02:00
|
|
|
require_relative "helper"
|
|
|
|
|
2018-07-19 13:46:51 +02:00
|
|
|
module Ruby
|
2018-06-25 15:32:20 +02:00
|
|
|
module OpAss
|
|
|
|
def test_local_name
|
|
|
|
assert_equal :foo , @lst.name
|
|
|
|
end
|
|
|
|
def test_local_value
|
|
|
|
assert_equal SendStatement , @lst.value.class
|
|
|
|
end
|
|
|
|
def test_local_method
|
|
|
|
assert_equal :+ , @lst.value.name
|
|
|
|
end
|
|
|
|
def test_local_receiver
|
|
|
|
assert_equal :foo , @lst.value.receiver.name
|
|
|
|
end
|
|
|
|
def test_local_receiver
|
|
|
|
assert_equal 5 , @lst.value.arguments.first.value
|
|
|
|
end
|
|
|
|
end
|
2018-07-19 15:30:36 +02:00
|
|
|
class TestLocalOpAssign < MiniTest::Test
|
2018-06-25 15:32:20 +02:00
|
|
|
include OpAss
|
2018-06-29 21:46:39 +02:00
|
|
|
include RubyTests
|
2018-06-25 15:32:20 +02:00
|
|
|
def setup
|
2018-06-29 21:46:39 +02:00
|
|
|
@lst = compile( "foo += 5")
|
2018-06-25 15:32:20 +02:00
|
|
|
end
|
|
|
|
def test_local_ass
|
|
|
|
assert_equal LocalAssignment , @lst.class
|
|
|
|
end
|
|
|
|
end
|
2018-07-19 15:30:36 +02:00
|
|
|
class TestIvarOpAssign < MiniTest::Test
|
2018-06-25 15:32:20 +02:00
|
|
|
include OpAss
|
2018-06-29 21:46:39 +02:00
|
|
|
include RubyTests
|
2018-06-25 15:32:20 +02:00
|
|
|
def setup
|
2018-06-29 21:46:39 +02:00
|
|
|
@lst = compile( "@foo += 5")
|
2018-06-25 15:32:20 +02:00
|
|
|
end
|
|
|
|
def test_ivar_ass
|
|
|
|
assert_equal IvarAssignment , @lst.class
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|