@@ -390,6 +390,16 @@ def test_display_method_inherited
390390 assert_match %r%^=== Implementation from Foo% , out
391391 end
392392
393+ def test_display_method_overriden
394+ util_multi_store
395+
396+ out , = capture_io do
397+ @driver . display_method 'Bar#override'
398+ end
399+
400+ refute_match %r%must not be displayed% , out
401+ end
402+
393403 def test_display_name_not_found_class
394404 util_store
395405
@@ -495,6 +505,32 @@ def test_find_methods_method
495505 assert_equal expected , items
496506 end
497507
508+ def test_filter_methods
509+ util_multi_store
510+
511+ name = 'Bar#override'
512+
513+ found = @driver . load_methods_matching name
514+
515+ sorted = @driver . filter_methods found , name
516+
517+ expected = [ [ @store2 , [ @override ] ] ]
518+
519+ assert_equal expected , sorted
520+ end
521+
522+ def test_filter_methods_not_found
523+ util_multi_store
524+
525+ name = 'Bar#inherit'
526+
527+ found = @driver . load_methods_matching name
528+
529+ sorted = @driver . filter_methods found , name
530+
531+ assert_equal found , sorted
532+ end
533+
498534 def test_formatter
499535 tty = Object . new
500536 def tty . tty? ( ) true ; end
@@ -533,6 +569,16 @@ def test_method_type
533569 assert_equal :class , @driver . method_type ( '::' )
534570 end
535571
572+ def test_name_regexp
573+ assert_equal /^RDoc::AnyMethod#new$/ ,
574+ @driver . name_regexp ( 'RDoc::AnyMethod#new' )
575+ assert_equal /^RDoc::AnyMethod::new$/ ,
576+ @driver . name_regexp ( 'RDoc::AnyMethod::new' )
577+
578+ assert_equal /^RDoc::AnyMethod(#|::)new$/ ,
579+ @driver . name_regexp ( 'RDoc::AnyMethod.new' )
580+ end
581+
536582 def test_list_known_classes
537583 util_store
538584
@@ -766,6 +812,7 @@ def util_multi_store
766812 @mAmbiguous = RDoc ::NormalModule . new 'Ambiguous'
767813
768814 @cFoo = RDoc ::NormalClass . new 'Foo'
815+
769816 @cBar = RDoc ::NormalClass . new 'Bar'
770817 @cBar . superclass = 'Foo'
771818 @cFoo_Baz = RDoc ::NormalClass . new 'Baz'
@@ -774,10 +821,15 @@ def util_multi_store
774821 @baz = RDoc ::AnyMethod . new nil , 'baz'
775822 @cBar . add_method @baz
776823
824+ @override = RDoc ::AnyMethod . new nil , 'override'
825+ @override . comment = 'must be displayed'
826+ @cBar . add_method @override
827+
777828 @store2 . save_class @mAmbiguous
778829 @store2 . save_class @cBar
779830 @store2 . save_class @cFoo_Baz
780831
832+ @store2 . save_method @cBar , @override
781833 @store2 . save_method @cBar , @baz
782834
783835 @store2 . save_cache
@@ -824,6 +876,11 @@ def util_store
824876 @inherit = RDoc ::AnyMethod . new nil , 'inherit'
825877 @cFoo . add_method @inherit
826878
879+ # overriden by Bar in multi_store
880+ @overriden = RDoc ::AnyMethod . new nil , 'override'
881+ @overriden . comment = 'must not be displayed'
882+ @cFoo . add_method @overriden
883+
827884 @store . save_class @cFoo
828885 @store . save_class @cFoo_Bar
829886 @store . save_class @cFoo_Baz
@@ -836,6 +893,7 @@ def util_store
836893 @store . save_method @cFoo_Bar , @attr
837894
838895 @store . save_method @cFoo , @inherit
896+ @store . save_method @cFoo , @overriden
839897
840898 @store . save_cache
841899
0 commit comments