rubyx/test/register/parfait/test_method.rb

24 lines
600 B
Ruby
Raw Normal View History

2015-09-27 15:06:48 +02:00
require_relative "../helper"
class TestMethod < MiniTest::Test
def setup
2016-12-06 11:08:18 +01:00
obj = Register.machine.space.get_class_by_name(:Object)
args = Parfait.new_list [ Parfait::Variable.new(:Integer , :bar )]
2015-09-27 15:06:48 +02:00
@method = ::Parfait::Method.new obj , :foo , args
end
def test_method_name
assert_equal :foo , @method.name
end
def test_arg1
assert_equal 1 , @method.arguments.get_length
assert_equal Parfait::Variable , @method.arguments.first.class
assert_equal :bar , @method.arguments.first.name
end
def test_has_arg
2015-10-14 20:36:51 +02:00
assert_equal 1 , @method.has_arg(:bar)
2015-09-27 15:06:48 +02:00
end
end