Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed ri page display for files with extensions

  • Loading branch information...
commit 176857343eea5c0c9e64bfaea4bde16c515f60f2 1 parent e6a73d3
@drbrain drbrain authored
Showing with 32 additions and 1 deletion.
  1. +5 −1 lib/rdoc/ri/driver.rb
  2. +27 −0 test/test_rdoc_ri_driver.rb
View
6 lib/rdoc/ri/driver.rb
@@ -1331,12 +1331,16 @@ def parse_name name
elsif parts.length == 2 or parts.last =~ /::|#|\./ then
type = parts.pop
meth = nil
+ elsif parts[1] == ':' then
+ klass = parts.shift
+ type = parts.shift
+ meth = parts.join
elsif parts[-2] != '::' or parts.last !~ /^[A-Z]/ then
meth = parts.pop
type = parts.pop
end
- klass = parts.join
+ klass ||= parts.join
[klass, type, meth]
end
View
27 test/test_rdoc_ri_driver.rb
@@ -747,6 +747,25 @@ def test_display_page_ambiguous
assert_match %r%README\.md%, out
end
+ def test_display_page_extension
+ util_store
+
+ other = @store1.add_file 'README.EXT'
+ other.parser = RDoc::Parser::Simple
+ other.comment =
+ doc(
+ head(1, 'README.EXT'),
+ para('This is the other README'))
+
+ @store1.save_page other
+
+ out, = capture_io do
+ @driver.display_page 'home:README.EXT'
+ end
+
+ assert_match 'other README', out
+ end
+
def test_display_page_ignore_directory
util_store
@@ -1147,6 +1166,14 @@ def test_parse_name_page
assert_equal nil, meth, 'ruby page'
end
+ def test_parse_name_page_extenson
+ klass, type, meth = @driver.parse_name 'ruby:README.EXT'
+
+ assert_equal 'ruby', klass, 'ruby project'
+ assert_equal ':', type, 'ruby type'
+ assert_equal 'README.EXT', meth, 'ruby page'
+ end
+
def test_parse_name_single_class
klass, type, meth = @driver.parse_name 'Foo'
Please sign in to comment.
Something went wrong with that request. Please try again.