rubyx/test/ruby/test_assignment.rb

53 lines
1.3 KiB
Ruby
Raw Normal View History

require_relative "helper"
2017-04-02 11:59:07 +02:00
module Ruby
2018-07-20 12:43:37 +02:00
class TestAssignment < MiniTest::Test
include RubyTests
2017-04-02 11:59:07 +02:00
def test_local
lst = compile( "foo = bar")
2017-04-02 11:59:07 +02:00
assert_equal LocalAssignment , lst.class
end
def test_local_name
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
lst = compile( "@foo = bar")
assert_equal IvarAssignment , lst.class
2017-04-04 17:10:28 +02:00
end
def test_instance_name
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
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
class TestAssignmentVool < MiniTest::Test
include RubyTests
2017-09-10 12:33:32 +02:00
2018-07-20 12:43:37 +02:00
def test_local
lst = compile( "foo = bar").to_vool
assert_equal Vool::LocalAssignment , lst.class
end
def test_local_name
lst = compile( "foo = bar").to_vool
assert_equal :foo , lst.name
end
def test_instance
lst = compile( "@foo = bar").to_vool
assert_equal Vool::IvarAssignment , lst.class
end
def test_instance_name
lst = compile( "@foo = bar").to_vool
assert_equal :foo , lst.name
end
def test_const
lst = compile( "@foo = 5").to_vool
assert_equal Vool::IvarAssignment , lst.class
end
2017-04-02 11:59:07 +02:00
end
end