2017-04-12 20:18:41 +03:00
|
|
|
require_relative "helper"
|
|
|
|
|
2018-07-19 14:46:51 +03:00
|
|
|
module Ruby
|
2018-07-19 16:30:36 +03:00
|
|
|
class TestLocalAssignment < MiniTest::Test
|
2018-06-29 22:46:39 +03:00
|
|
|
include RubyTests
|
2017-04-12 20:18:41 +03:00
|
|
|
|
|
|
|
def test_local
|
2018-06-29 22:46:39 +03:00
|
|
|
lst = compile( "foo = bar")
|
2017-04-12 20:18:41 +03:00
|
|
|
assert_equal LocalAssignment , lst.class
|
|
|
|
end
|
|
|
|
def test_local_name
|
2018-06-29 22:46:39 +03:00
|
|
|
lst = compile( "foo = bar")
|
2017-04-12 20:18:41 +03:00
|
|
|
assert_equal :foo , lst.name
|
|
|
|
end
|
2017-09-10 13:04:36 +03:00
|
|
|
def test_local_const
|
2018-06-29 22:46:39 +03:00
|
|
|
lst = compile( "foo = 5")
|
2017-09-10 13:04:36 +03:00
|
|
|
assert_equal LocalAssignment , lst.class
|
|
|
|
end
|
2018-03-18 22:38:00 +05:30
|
|
|
def test_local_ivar
|
2018-06-29 22:46:39 +03:00
|
|
|
lst = compile( "foo = @iv")
|
2018-03-18 22:38:00 +05:30
|
|
|
assert_equal LocalAssignment , lst.class
|
|
|
|
assert_equal InstanceVariable , lst.value.class
|
|
|
|
end
|
2017-04-12 20:18:41 +03:00
|
|
|
|
|
|
|
end
|
|
|
|
end
|