2017-04-12 19:18:41 +02:00
|
|
|
require_relative "helper"
|
|
|
|
|
2018-07-19 13:46:51 +02:00
|
|
|
module Ruby
|
2018-07-07 16:57:46 +02:00
|
|
|
class TestLocalAssignmentX < MiniTest::Test
|
2018-06-29 21:46:39 +02:00
|
|
|
include RubyTests
|
2017-04-12 19:18:41 +02:00
|
|
|
|
|
|
|
def test_local
|
2018-06-29 21:46:39 +02:00
|
|
|
lst = compile( "foo = bar")
|
2017-04-12 19:18:41 +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-12 19:18:41 +02:00
|
|
|
assert_equal :foo , lst.name
|
|
|
|
end
|
2017-09-10 12:04:36 +02:00
|
|
|
def test_local_const
|
2018-06-29 21:46:39 +02:00
|
|
|
lst = compile( "foo = 5")
|
2017-09-10 12:04:36 +02:00
|
|
|
assert_equal LocalAssignment , lst.class
|
|
|
|
end
|
2018-03-18 18:08:00 +01:00
|
|
|
def test_local_ivar
|
2018-06-29 21:46:39 +02:00
|
|
|
lst = compile( "foo = @iv")
|
2018-03-18 18:08:00 +01:00
|
|
|
assert_equal LocalAssignment , lst.class
|
|
|
|
assert_equal InstanceVariable , lst.value.class
|
|
|
|
end
|
2017-04-12 19:18:41 +02:00
|
|
|
|
|
|
|
end
|
|
|
|
end
|