From 0e655546b4d3f9d00982f12f87f968dd5b96103a Mon Sep 17 00:00:00 2001 From: Nikita Misharin Date: Sat, 23 Jun 2018 22:28:44 +0300 Subject: [PATCH] Add tests to cover + methods --- test/test_rdoc_any_method.rb | 4 ++-- test/test_rdoc_class_module.rb | 1 + test/test_rdoc_context.rb | 2 +- test/test_rdoc_cross_reference.rb | 20 +++++++++++++------- test/xref_data.rb | 2 ++ test/xref_test_case.rb | 7 ++++--- 6 files changed, 23 insertions(+), 13 deletions(-) diff --git a/test/test_rdoc_any_method.rb b/test/test_rdoc_any_method.rb index b5281f611d..adac915aab 100644 --- a/test/test_rdoc_any_method.rb +++ b/test/test_rdoc_any_method.rb @@ -165,7 +165,7 @@ def test_marshal_load_aliased_method_with_nil_singleton end def test_marshal_load_class_method - class_method = Marshal.load Marshal.dump(@c1.method_list.first) + class_method = Marshal.load Marshal.dump(@c1.find_class_method_named 'm') assert_equal 'C1::m', class_method.full_name assert_equal 'C1', class_method.parent_name @@ -174,7 +174,7 @@ def test_marshal_load_class_method end def test_marshal_load_instance_method - instance_method = Marshal.load Marshal.dump(@c1.method_list.last) + instance_method = Marshal.load Marshal.dump(@c1.find_instance_method_named 'm') assert_equal 'C1#m', instance_method.full_name assert_equal 'C1', instance_method.parent_name diff --git a/test/test_rdoc_class_module.rb b/test/test_rdoc_class_module.rb index 3dc2a42cf4..cc53a13528 100644 --- a/test/test_rdoc_class_module.rb +++ b/test/test_rdoc_class_module.rb @@ -91,6 +91,7 @@ def test_docuent_self_or_methods assert @c1.document_self_or_methods + @c1_plus.document_self = false @c1_m.document_self = false assert @c1.document_self_or_methods diff --git a/test/test_rdoc_context.rb b/test/test_rdoc_context.rb index 5a9c5db39e..be17496f40 100644 --- a/test/test_rdoc_context.rb +++ b/test/test_rdoc_context.rb @@ -660,7 +660,7 @@ def test_methods_by_type 'instance' => { :private => [], :protected => [], - :public => [@c1_m], + :public => [@c1_plus, @c1_m], }, 'class' => { :private => [], diff --git a/test/test_rdoc_cross_reference.rb b/test/test_rdoc_cross_reference.rb index 7a7035a605..8233fe3f61 100644 --- a/test/test_rdoc_cross_reference.rb +++ b/test/test_rdoc_cross_reference.rb @@ -107,18 +107,24 @@ def test_resolve_file end def test_resolve_method - assert_ref @c1__m, 'm' - assert_ref @c1_m, '#m' - assert_ref @c1__m, '::m' - - assert_ref @c1_m, 'C1#m' - assert_ref @c1__m, 'C1.m' - assert_ref @c1__m, 'C1::m' + assert_ref @c1__m, 'm' + assert_ref @c1__m, '::m' + assert_ref @c1_m, '#m' + assert_ref @c1_plus, '#+' + + assert_ref @c1_m, 'C1#m' + assert_ref @c1_plus, 'C1#+' + assert_ref @c1__m, 'C1.m' + assert_ref @c1__m, 'C1::m' assert_ref @c1_m, 'C1#m' assert_ref @c1_m, 'C1#m()' assert_ref @c1_m, 'C1#m(*)' + assert_ref @c1_plus, 'C1#+' + assert_ref @c1_plus, 'C1#+()' + assert_ref @c1_plus, 'C1#+(*)' + assert_ref @c1__m, 'C1.m' assert_ref @c1__m, 'C1.m()' assert_ref @c1__m, 'C1.m(*)' diff --git a/test/xref_data.rb b/test/xref_data.rb index 77380aa868..aa9faaecd9 100644 --- a/test/xref_data.rb +++ b/test/xref_data.rb @@ -20,6 +20,8 @@ def self.m def m foo end + def + + end end class C2 diff --git a/test/xref_test_case.rb b/test/xref_test_case.rb index 28b03e89cd..d42cf398e7 100644 --- a/test/xref_test_case.rb +++ b/test/xref_test_case.rb @@ -31,9 +31,10 @@ def generator.file_dir() nil end @rdoc.options = @options @rdoc.generator = generator - @c1 = @xref_data.find_module_named 'C1' - @c1_m = @c1.method_list.last # C1#m - @c1__m = @c1.method_list.first # C1::m + @c1 = @xref_data.find_module_named 'C1' + @c1__m = @c1.find_class_method_named 'm' # C1::m + @c1_m = @c1.find_instance_method_named 'm' # C1#m + @c1_plus = @c1.find_instance_method_named '+' @c2 = @xref_data.find_module_named 'C2' @c2_a = @c2.method_list.last