@@ -72,6 +72,54 @@ def test_is_alias_for
72
72
assert_nil m1 . is_alias_for , 'missing alias'
73
73
end
74
74
75
+ def test_call_seq_handles_aliases
76
+ # see 0ead786
77
+ @store . path = Dir . tmpdir
78
+ top_level = @store . add_file 'file.rb'
79
+ cm = top_level . add_class RDoc ::ClassModule , 'Klass'
80
+
81
+ method_with_call_seq = RDoc ::AnyMethod . new ( nil , "method_with_call_seq" )
82
+ method_with_call_seq . call_seq = <<~SEQ
83
+ method_with_call_seq(a)
84
+ method_with_call_seq(a, b)
85
+ alias_to_method(a)
86
+ alias_to_method(a, b)
87
+ SEQ
88
+ cm . add_method ( method_with_call_seq )
89
+
90
+ alias_to_method = method_with_call_seq . add_alias (
91
+ RDoc ::Alias . new ( nil , "method_with_call_seq" , "alias_to_method" , "comment" ) ,
92
+ cm
93
+ )
94
+
95
+ assert_equal ( "method_with_call_seq(a)\n method_with_call_seq(a, b)" ,
96
+ method_with_call_seq . call_seq )
97
+ assert_equal ( "alias_to_method(a)\n alias_to_method(a, b)" ,
98
+ alias_to_method . call_seq )
99
+ end
100
+
101
+ def test_call_seq_returns_nil_if_alias_is_missing_from_call_seq
102
+ @store . path = Dir . tmpdir
103
+ top_level = @store . add_file 'file.rb'
104
+ cm = top_level . add_class RDoc ::ClassModule , 'Klass'
105
+
106
+ method_with_call_seq = RDoc ::AnyMethod . new ( nil , "method_with_call_seq" )
107
+ method_with_call_seq . call_seq = <<~SEQ
108
+ method_with_call_seq(a)
109
+ method_with_call_seq(a, b)
110
+ SEQ
111
+ cm . add_method ( method_with_call_seq )
112
+
113
+ alias_to_method = method_with_call_seq . add_alias (
114
+ RDoc ::Alias . new ( nil , "method_with_call_seq" , "alias_to_method" , "comment" ) ,
115
+ cm
116
+ )
117
+
118
+ assert_equal ( "method_with_call_seq(a)\n method_with_call_seq(a, b)" ,
119
+ method_with_call_seq . call_seq )
120
+ assert_nil ( alias_to_method . call_seq )
121
+ end
122
+
75
123
def test_markup_code
76
124
tokens = [
77
125
{ :line_no => 0 , :char_no => 0 , :kind => :on_const , :text => 'CONSTANT' } ,
0 commit comments