diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-30 01:39:03 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-30 01:39:03 +0000 |
commit | 696ebcd8cafece7c0ed6407af9679699a16a5c5a (patch) | |
tree | e06e2d541959569dc20256053a21652671dabb70 | |
parent | e553663cbda58188d085a0e6e5a71d52d3d95c5a (diff) |
* lib/rdoc/ri/driver.rb: Relaxed matching for pages to be more
user-friendly.
* test/rdoc/test_rdoc_ri_driver.rb: Test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | lib/rdoc/ri/driver.rb | 6 | ||||
-rw-r--r-- | test/rdoc/test_rdoc_ri_driver.rb | 34 |
3 files changed, 44 insertions, 2 deletions
@@ -1,3 +1,9 @@ +Fri Nov 30 10:38:54 2012 Eric Hodel <[email protected]> + + * lib/rdoc/ri/driver.rb: Relaxed matching for pages to be more + user-friendly. + * test/rdoc/test_rdoc_ri_driver.rb: Test for above. + Fri Nov 30 09:50:16 2012 Eric Hodel <[email protected]> * lib/rdoc/markdown.rb: Fixed warnings with -w diff --git a/lib/rdoc/ri/driver.rb b/lib/rdoc/ri/driver.rb index 4beda55881..4f5e13034e 100644 --- a/lib/rdoc/ri/driver.rb +++ b/lib/rdoc/ri/driver.rb @@ -842,10 +842,12 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the unless pages.include? page_name then found_names = pages.select do |n| - n =~ /^#{Regexp.escape page_name}\.[^.]+$/ + n =~ /#{Regexp.escape page_name}\.[^.]+$/ end - if found_names.length > 1 then + if found_names.length.zero? then + return display_page_list store, pages + elsif found_names.length > 1 then return display_page_list store, found_names, page_name end diff --git a/test/rdoc/test_rdoc_ri_driver.rb b/test/rdoc/test_rdoc_ri_driver.rb index 3f0e667784..37f29fbdfc 100644 --- a/test/rdoc/test_rdoc_ri_driver.rb +++ b/test/rdoc/test_rdoc_ri_driver.rb @@ -747,6 +747,40 @@ Foo::Bar#bother assert_match %r%README\.md%, out end + def test_display_page_ignore_directory + util_store + + other = @store1.add_file 'doc/globals.rdoc' + other.parser = RDoc::Parser::Simple + other.comment = + doc( + head(1, 'globals.rdoc'), + para('Globals go here')) + + @store1.save_page other + + out, = capture_io do + @driver.display_page 'home:globals' + end + + assert_match %r%= globals\.rdoc%, out + end + + def test_display_page_missing + util_store + + out, = capture_io do + @driver.display_page 'home:missing' + end + + out, = capture_io do + @driver.display_page_list @store1 + end + + assert_match %r%= Pages in ~/\.rdoc%, out + assert_match %r%README\.rdoc%, out + end + def test_display_page_list util_store |