File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -244,5 +244,34 @@ def test_parent_name
244
244
assert_equal 'C1' , @c1 . method_list . last . parent_name
245
245
end
246
246
247
+ def test_find_superclass_method
248
+ k3 = RDoc ::NormalClass . new "RDoc::CodeObject" , nil
249
+ k2 = RDoc ::NormalClass . new "RDoc::MethodAttr" , k3
250
+ k = RDoc ::NormalClass . new "RDoc::AnyMethod" , k2
251
+
252
+ m = RDoc ::AnyMethod . new "def test_super" , "test_super"
253
+ m2 = RDoc ::AnyMethod . new "def test_super" , "test_super"
254
+ m3 = RDoc ::AnyMethod . new "def test_no_super" , "test_no_super"
255
+
256
+ m . uses_superclass = true
257
+ k . add_method m
258
+ k . add_method m3
259
+
260
+ k2 . add_method m2
261
+
262
+ assert_nil ( m3 . find_superclass_method , 'no superclass method for "test_no_super"' )
263
+ assert_equal ( m2 , m . find_superclass_method , 'superclass method found for "test_super"' )
264
+
265
+ k2 = RDoc ::NormalClass . new "RDoc::MethodAttr" , k3
266
+ k = RDoc ::NormalClass . new "RDoc::AnyMethod" , k2
267
+
268
+ m . uses_superclass = true
269
+ k . add_method m
270
+ k . add_method m3
271
+
272
+ k3 . add_method m2
273
+
274
+ assert_equal ( m2 , m . find_superclass_method , 'superclass method found two levels up' )
275
+ end
247
276
end
248
277
You can’t perform that action at this time.
0 commit comments