Skip to content

Commit

Permalink
RDoc can now link #=== methods
Browse files Browse the repository at this point in the history
The METHOD_REGEXP_STR was missing === so it could not be linked.

Fixes #164
  • Loading branch information
drbrain committed Jan 4, 2013
1 parent 6dd8d41 commit ebc6666
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions History.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ to build HTML documentation when installing gems.)
* RDoc now ignores methods defined on constants instead of creating a fake
module. Bug #163 by Zachary Scott.
* Fixed ChangeLog parsing for FFI gem. Bug #165 by Zachary Scott.
* RDoc now links \#=== methods. Bug #164 by Zachary Scott.

=== 4.0.0.preview2.1 / 2012-12-14

Expand Down
2 changes: 1 addition & 1 deletion lib/rdoc/cross_reference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class RDoc::CrossReference
#
# See CLASS_REGEXP_STR

METHOD_REGEXP_STR = '([a-z]\w*[!?=]?|%)(?:\([\w.+*/=<>-]*\))?'
METHOD_REGEXP_STR = '([a-z]\w*[!?=]?|%|===)(?:\([\w.+*/=<>-]*\))?'

##
# Regular expressions matching text that should potentially have
Expand Down
15 changes: 15 additions & 0 deletions test/test_rdoc_cross_reference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ def refute_ref name
assert_equal name, @xref.resolve(name, name)
end

def test_METHOD_REGEXP_STR
re = /#{RDoc::CrossReference::METHOD_REGEXP_STR}/

re =~ '==='

assert_equal '===', $&
end

def test_resolve_C2
@xref = RDoc::CrossReference.new @c2

Expand Down Expand Up @@ -129,6 +137,13 @@ def test_resolve_method
assert_ref @c2_c3_m, '::C2::C3#m(*)'
end

def test_resolve_method_equals3
m = RDoc::AnyMethod.new '', '==='
@c1.add_method m

assert_ref m, '==='
end

def test_resolve_page
page = @store.add_file 'README.txt'
page.parser = RDoc::Parser::Simple
Expand Down

0 comments on commit ebc6666

Please sign in to comment.