diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-05-14 00:39:16 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-05-14 00:39:16 +0000 |
commit | 0b6da24a5e24ff9ce8e153d2f073c2363e94b28e (patch) | |
tree | 95eb233fee15aae2fa2ba7dbeb1bb9c7bdfd9e1d /test/rdoc/test_rdoc_ri_driver.rb | |
parent | fe89874540f5e95fbfd933a72fff2ad31b8e8d07 (diff) |
* lib/rdoc.rb: Updated to RDoc 3.6
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rdoc/test_rdoc_ri_driver.rb')
-rw-r--r-- | test/rdoc/test_rdoc_ri_driver.rb | 51 |
1 files changed, 45 insertions, 6 deletions
diff --git a/test/rdoc/test_rdoc_ri_driver.rb b/test/rdoc/test_rdoc_ri_driver.rb index 2d735044dd..b0e0e787c0 100644 --- a/test/rdoc/test_rdoc_ri_driver.rb +++ b/test/rdoc/test_rdoc_ri_driver.rb @@ -3,6 +3,7 @@ require 'rubygems' require 'minitest/autorun' require 'tmpdir' require 'fileutils' +require 'stringio' require 'rdoc/ri/driver' class TestRDocRIDriver < MiniTest::Unit::TestCase @@ -249,12 +250,14 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase @driver.stores = [store] - assert_equal %w[Foo Foo::Bar], @driver.complete('F') + assert_equal %w[Foo ], @driver.complete('F') assert_equal %w[ Foo::Bar], @driver.complete('Foo::B') - assert_equal %w[Foo#Bar], @driver.complete('Foo#'), 'Foo#' - assert_equal %w[Foo#Bar Foo::bar], @driver.complete('Foo.'), 'Foo.' - assert_equal %w[Foo::Bar Foo::bar], @driver.complete('Foo::'), 'Foo::' + assert_equal %w[Foo#Bar], @driver.complete('Foo#'), 'Foo#' + assert_equal %w[Foo#Bar Foo::bar], @driver.complete('Foo.'), 'Foo.' + assert_equal %w[Foo::Bar Foo::bar], @driver.complete('Foo::'), 'Foo::' + + assert_equal %w[ Foo::bar], @driver.complete('Foo::b'), 'Foo::b' end def test_complete_ancestor @@ -269,7 +272,7 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase def test_complete_classes util_store - assert_equal %w[Foo Foo::Bar Foo::Baz], @driver.complete('F') + assert_equal %w[Foo ], @driver.complete('F') assert_equal %w[Foo:: Foo::Bar Foo::Baz], @driver.complete('Foo::') assert_equal %w[ Foo::Bar Foo::Baz], @driver.complete('Foo::B') end @@ -278,7 +281,8 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase util_multi_store assert_equal %w[Bar], @driver.complete('B') - assert_equal %w[Foo Foo::Bar Foo::Baz], @driver.complete('F') + assert_equal %w[Foo], @driver.complete('F') + assert_equal %w[Foo::Bar Foo::Baz], @driver.complete('Foo::B') end def test_display @@ -572,11 +576,18 @@ Foo::Bar#bother def test_name_regexp assert_equal %r%^RDoc::AnyMethod#new$%, @driver.name_regexp('RDoc::AnyMethod#new') + assert_equal %r%^RDoc::AnyMethod::new$%, @driver.name_regexp('RDoc::AnyMethod::new') assert_equal %r%^RDoc::AnyMethod(#|::)new$%, @driver.name_regexp('RDoc::AnyMethod.new') + + assert_equal %r%^Hash(#|::)\[\]$%, + @driver.name_regexp('Hash.[]') + + assert_equal %r%^Hash::\[\]$%, + @driver.name_regexp('Hash::[]') end def test_list_known_classes @@ -589,6 +600,16 @@ Foo::Bar#bother assert_equal "Ambiguous\nFoo\nFoo::Bar\nFoo::Baz\nInc\n", out end + def test_list_known_classes_name + util_store + + out, = capture_io do + @driver.list_known_classes %w[F I] + end + + assert_equal "Foo\nFoo::Bar\nFoo::Baz\nInc\n", out + end + def test_list_methods_matching util_store @@ -596,6 +617,24 @@ Foo::Bar#bother @driver.list_methods_matching('Foo::Bar.') end + def test_list_methods_matching_regexp + util_store + + index = RDoc::AnyMethod.new nil, '[]' + @cFoo.add_method index + @store.save_method @cFoo, index + + c_index = RDoc::AnyMethod.new nil, '[]' + c_index.singleton = true + @cFoo.add_method c_index + @store.save_method @cFoo, c_index + + @store.save_cache + + assert_equal %w[Foo#[]], @driver.list_methods_matching('Foo#[]') + assert_equal %w[Foo::[]], @driver.list_methods_matching('Foo::[]') + end + def test_load_method util_store |