1require '-test-/method' 2require 'test/unit' 3 4class TestMethod < Test::Unit::TestCase 5 class TestArity < Test::Unit::TestCase 6 class A 7 def foo0() 8 end 9 def foom1(*a) 10 end 11 def foom2(a,*b) 12 end 13 def foo1(a) 14 end 15 def foo2(a,b) 16 end 17 end 18 19 class B<A 20 private :foo1, :foo2 21 end 22 23 METHODS = {foo0: 0, foo1: 1, foo2: 2, foom1: -1, foom2: -2} 24 25 def test_base 26 METHODS.each do |name, arity| 27 assert_equal(arity, Bug::Method.mod_method_arity(A, name), "A##{name}") 28 end 29 end 30 31 def test_zsuper 32 METHODS.each do |name, arity| 33 assert_equal(arity, Bug::Method.mod_method_arity(B, name), "B##{name}") 34 end 35 end 36 end 37end 38