1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/rdoc.rb: Import RDoc 3.7 release candidate

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2011-06-16 04:59:24 +00:00
parent 97ac172d58
commit b7528b5edb
58 changed files with 2637 additions and 277 deletions

View file

@ -22,11 +22,11 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
ENV['HOME'] = @tmpdir
ENV.delete 'RI'
options = RDoc::RI::Driver.process_args []
options[:home] = @tmpdir
options[:use_stdout] = true
options[:formatter] = @RM::ToRdoc
@driver = RDoc::RI::Driver.new options
@options = RDoc::RI::Driver.process_args []
@options[:home] = @tmpdir
@options[:use_stdout] = true
@options[:formatter] = @RM::ToRdoc
@driver = RDoc::RI::Driver.new @options
end
def teardown
@ -191,12 +191,30 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
def test_add_method_list
out = @RM::Document.new
@driver.add_method_list out, %w[new], 'Class methods'
@driver.add_method_list out, %w[new parse], 'Class methods'
expected = @RM::Document.new(
@RM::Heading.new(1, 'Class methods:'),
@RM::BlankLine.new,
@RM::Verbatim.new('new'),
@RM::Verbatim.new('parse'),
@RM::BlankLine.new)
assert_equal expected, out
end
def test_add_method_list_interative
@options[:interactive] = true
driver = RDoc::RI::Driver.new @options
out = @RM::Document.new
driver.add_method_list out, %w[new parse], 'Class methods'
expected = @RM::Document.new(
@RM::Heading.new(1, 'Class methods:'),
@RM::BlankLine.new,
@RM::IndentedParagraph.new(2, 'new, parse'),
@RM::BlankLine.new)
assert_equal expected, out
@ -272,6 +290,8 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
def test_complete_classes
util_store
assert_equal %w[ ], @driver.complete('[')
assert_equal %w[ ], @driver.complete('[::')
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')
@ -621,11 +641,13 @@ Foo::Bar#bother
util_store
index = RDoc::AnyMethod.new nil, '[]'
index.record_location @top_level
@cFoo.add_method index
@store.save_method @cFoo, index
c_index = RDoc::AnyMethod.new nil, '[]'
c_index.singleton = true
c_index.record_location @top_level
@cFoo.add_method c_index
@store.save_method @cFoo, c_index
@ -858,10 +880,12 @@ Foo::Bar#bother
@cFoo_Baz.parent = @cFoo
@baz = RDoc::AnyMethod.new nil, 'baz'
@baz.record_location @top_level
@cBar.add_method @baz
@override = RDoc::AnyMethod.new nil, 'override'
@override.comment = 'must be displayed'
@override.record_location @top_level
@cBar.add_method @override
@store2.save_class @mAmbiguous
@ -879,6 +903,8 @@ Foo::Bar#bother
def util_store
@store = RDoc::RI::Store.new @home_ri
@top_level = RDoc::TopLevel.new 'file.rb'
@cFoo = RDoc::NormalClass.new 'Foo'
@mInc = RDoc::NormalModule.new 'Inc'
@cAmbiguous = RDoc::NormalClass.new 'Ambiguous'
@ -886,6 +912,7 @@ Foo::Bar#bother
doc = @RM::Document.new @RM::Paragraph.new('Include thingy')
@cFooInc = RDoc::Include.new 'Inc', doc
@cFooInc.record_location @top_level
@cFoo.add_include @cFooInc
@cFoo_Bar = RDoc::NormalClass.new 'Bar'
@ -893,12 +920,15 @@ Foo::Bar#bother
@blah = RDoc::AnyMethod.new nil, 'blah'
@blah.call_seq = "blah(5) => 5\nblah(6) => 6\n"
@blah.record_location @top_level
@bother = RDoc::AnyMethod.new nil, 'bother'
@bother.params = "(things)"
@bother.block_params = "stuff"
@bother.params = "(things)"
@bother.record_location @top_level
@new = RDoc::AnyMethod.new nil, 'new'
@new.record_location @top_level
@new.singleton = true
@cFoo_Bar.add_method @blah
@ -906,6 +936,7 @@ Foo::Bar#bother
@cFoo_Bar.add_method @new
@attr = RDoc::Attr.new nil, 'attr', 'RW', ''
@attr.record_location @top_level
@cFoo_Bar.add_attribute @attr
@ -913,11 +944,13 @@ Foo::Bar#bother
@cFoo_Baz.parent = @cFoo
@inherit = RDoc::AnyMethod.new nil, 'inherit'
@inherit.record_location @top_level
@cFoo.add_method @inherit
# overriden by Bar in multi_store
@overriden = RDoc::AnyMethod.new nil, 'override'
@overriden.comment = 'must not be displayed'
@overriden.record_location @top_level
@cFoo.add_method @overriden
@store.save_class @cFoo