Debian Codegraph @

test/-ext-/method/test_arity.rb

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