@@ -154,6 +154,42 @@ def foo(a)
154
154
assert_argument ( collector , "a" , definitions : [ 1 ] , usages : [ 2 ] )
155
155
end
156
156
157
+ def test_collecting_methods_with_destructured_post_arguments
158
+ collector = Collector . collect ( <<~RUBY )
159
+ def foo(optional = 1, (bin, bag))
160
+ end
161
+ RUBY
162
+
163
+ assert_equal ( 3 , collector . arguments . length )
164
+ assert_argument ( collector , "optional" , definitions : [ 1 ] , usages : [ ] )
165
+ assert_argument ( collector , "bin" , definitions : [ 1 ] , usages : [ ] )
166
+ assert_argument ( collector , "bag" , definitions : [ 1 ] , usages : [ ] )
167
+ end
168
+
169
+ def test_collecting_methods_with_desctructured_post_using_splat
170
+ collector = Collector . collect ( <<~RUBY )
171
+ def foo(optional = 1, (bin, bag, *))
172
+ end
173
+ RUBY
174
+
175
+ assert_equal ( 3 , collector . arguments . length )
176
+ assert_argument ( collector , "optional" , definitions : [ 1 ] , usages : [ ] )
177
+ assert_argument ( collector , "bin" , definitions : [ 1 ] , usages : [ ] )
178
+ assert_argument ( collector , "bag" , definitions : [ 1 ] , usages : [ ] )
179
+ end
180
+
181
+ def test_collecting_methods_with_nested_desctructured
182
+ collector = Collector . collect ( <<~RUBY )
183
+ def foo(optional = 1, (bin, (bag)))
184
+ end
185
+ RUBY
186
+
187
+ assert_equal ( 3 , collector . arguments . length )
188
+ assert_argument ( collector , "optional" , definitions : [ 1 ] , usages : [ ] )
189
+ assert_argument ( collector , "bin" , definitions : [ 1 ] , usages : [ ] )
190
+ assert_argument ( collector , "bag" , definitions : [ 1 ] , usages : [ ] )
191
+ end
192
+
157
193
def test_collecting_singleton_method_arguments
158
194
collector = Collector . collect ( <<~RUBY )
159
195
def self.foo(a)
0 commit comments