From dd362a786af7f5131844652fa85a07539b4da9b8 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Fri, 15 Jul 2022 17:39:21 -0400 Subject: [ruby/rdoc] Fix call-seq for aliased method with similar names deduplicate_call_seq has a bug that skips call-seq for methods where the alias is a prefix of the method name. For example, if the alias name is "each" and the current method name is "each_line", then deduplicate_call_seq will skip all call-seq for "each_line" since it will believe that it is for the alias. https://github.com/ruby/rdoc/commit/1148988ccc --- test/rdoc/test_rdoc_any_method.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/rdoc') diff --git a/test/rdoc/test_rdoc_any_method.rb b/test/rdoc/test_rdoc_any_method.rb index 826ef1c8d8..6915b466f0 100644 --- a/test/rdoc/test_rdoc_any_method.rb +++ b/test/rdoc/test_rdoc_any_method.rb @@ -51,6 +51,20 @@ method(a, b) { |c, d| ... } assert_equal 'foo', m.call_seq end + def test_call_seq_alias_for + a = RDoc::AnyMethod.new nil, "each" + m = RDoc::AnyMethod.new nil, "each_line" + + a.call_seq = <<-CALLSEQ +each(foo) +each_line(foo) + CALLSEQ + + m.is_alias_for = a + + assert_equal "each_line(foo)", m.call_seq + end + def test_full_name assert_equal 'C1::m', @c1.method_list.first.full_name end -- cgit v1.2.1