Skip to content

Commit

Permalink
Add tests to cover + methods
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSmartnik committed Jun 23, 2018
1 parent 9171f63 commit 0e65554
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 13 deletions.
4 changes: 2 additions & 2 deletions test/test_rdoc_any_method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions test/test_rdoc_class_module.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/test_rdoc_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ def test_methods_by_type
'instance' => {
:private => [],
:protected => [],
:public => [@c1_m],
:public => [@c1_plus, @c1_m],
},
'class' => {
:private => [],
Expand Down
20 changes: 13 additions & 7 deletions test/test_rdoc_cross_reference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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(*)'
Expand Down
2 changes: 2 additions & 0 deletions test/xref_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ def self.m
def m foo
end
def +
end
end
class C2
Expand Down
7 changes: 4 additions & 3 deletions test/xref_test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0e65554

Please sign in to comment.