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

Import RDoc 3

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2010-12-20 03:22:49 +00:00
parent d7effd506f
commit 2ef9c50c6e
106 changed files with 8878 additions and 4179 deletions

View file

@ -53,7 +53,7 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
def test_self_dump
util_store
out, err = capture_io do
out, = capture_io do
RDoc::RI::Driver.dump @store.cache_path
end
@ -83,8 +83,8 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
expected = @RM::Document.new(
@RM::Rule.new(1),
@RM::Paragraph.new('Also found in:'),
@RM::Verbatim.new(' ', 'ruby core', "\n",
' ', '~/.ri', "\n"))
@RM::Verbatim.new("ruby core\n",
"~/.ri\n"))
assert_equal expected, out
end
@ -143,7 +143,7 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
@RM::BlankLine.new,
@RM::Paragraph.new("Include thingy"),
@RM::BlankLine.new,
@RM::Verbatim.new(' ', 'Enumerable', "\n"))
@RM::Verbatim.new("Enumerable\n"))
assert_equal expected, out
end
@ -163,8 +163,8 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
@RM::Rule.new(1),
@RM::Heading.new(1, "Includes:"),
@RM::Paragraph.new("(from #{@store.friendly_path})"),
@RM::Verbatim.new(' ', 'Inc', "\n",
' ', 'Enumerable', "\n"))
@RM::Verbatim.new("Inc\n",
"Enumerable\n"))
assert_equal expected, out
end
@ -195,7 +195,7 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
expected = @RM::Document.new(
@RM::Heading.new(1, 'Class methods:'),
@RM::BlankLine.new,
@RM::Verbatim.new(' ', 'new'),
@RM::Verbatim.new('new'),
@RM::BlankLine.new)
assert_equal expected, out
@ -285,7 +285,7 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
doc = @RM::Document.new(
@RM::Paragraph.new('hi'))
out, err = capture_io do
out, = capture_io do
@driver.display doc
end
@ -295,12 +295,12 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
def test_display_class
util_store
out, err = capture_io do
out, = capture_io do
@driver.display_class 'Foo::Bar'
end
assert_match %r%^= Foo::Bar%, out
assert_match %r%^\(from%, out # )
assert_match %r%^\(from%, out
assert_match %r%^= Class methods:%, out
assert_match %r%^ new%, out
@ -315,7 +315,7 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
def test_display_class_ambiguous
util_multi_store
out, err = capture_io do
out, = capture_io do
@driver.display_class 'Ambiguous'
end
@ -325,7 +325,7 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
def test_display_class_multi_no_doc
util_multi_store
out, err = capture_io do
out, = capture_io do
@driver.display_class 'Foo::Baz'
end
@ -339,7 +339,7 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
def test_display_class_superclass
util_multi_store
out, err = capture_io do
out, = capture_io do
@driver.display_class 'Bar'
end
@ -349,7 +349,7 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
def test_display_class_module
util_store
out, err = capture_io do
out, = capture_io do
@driver.display_class 'Inc'
end
@ -359,7 +359,7 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
def test_display_method
util_store
out, err = capture_io do
out, = capture_io do
@driver.display_method 'Foo::Bar#blah'
end
@ -371,7 +371,7 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
def test_display_method_attribute
util_store
out, err = capture_io do
out, = capture_io do
@driver.display_method 'Foo::Bar#attr'
end
@ -382,7 +382,7 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
def test_display_method_inherited
util_multi_store
out, err = capture_io do
out, = capture_io do
@driver.display_method 'Bar#inherit'
end
@ -393,7 +393,7 @@ class TestRDocRIDriver < MiniTest::Unit::TestCase
def test_display_name_not_found_class
util_store
out, err = capture_io do
out, = capture_io do
assert_equal false, @driver.display_name('Foo::B')
end
@ -410,7 +410,7 @@ Foo::Baz
def test_display_name_not_found_method
util_store
out, err = capture_io do
out, = capture_io do
assert_equal false, @driver.display_name('Foo::Bar#b')
end
@ -427,7 +427,7 @@ Foo::Bar#bother
def test_display_method_params
util_store
out, err = capture_io do
out, = capture_io do
@driver.display_method 'Foo::Bar#bother'
end
@ -496,24 +496,34 @@ Foo::Bar#bother
end
def test_formatter
tty = Object.new
def tty.tty?() true; end
driver = RDoc::RI::Driver.new
io = Object.new
def io.tty?; false; end
assert_instance_of @RM::ToAnsi, driver.formatter(tty)
assert_instance_of @RM::ToBs, driver.formatter(io)
def io.tty?; true; end
assert_instance_of @RM::ToAnsi, driver.formatter(io)
assert_instance_of @RM::ToBs, driver.formatter(StringIO.new)
driver.instance_variable_set :@paging, true
assert_instance_of @RM::ToBs, driver.formatter(io)
assert_instance_of @RM::ToBs, driver.formatter(StringIO.new)
driver.instance_variable_set :@formatter_klass, @RM::ToHtml
assert_instance_of @RM::ToHtml, driver.formatter(io)
assert_instance_of @RM::ToHtml, driver.formatter(tty)
end
def test_in_path_eh
path = ENV['PATH']
refute @driver.in_path?('/nonexistent')
ENV['PATH'] = File.expand_path '..', __FILE__
assert @driver.in_path?(File.basename(__FILE__))
ensure
ENV['PATH'] = path
end
def test_method_type
@ -526,8 +536,8 @@ Foo::Bar#bother
def test_list_known_classes
util_store
out, err = capture_io do
@driver.list_known_classes
out, = capture_io do
@driver.list_known_classes
end
assert_equal "Ambiguous\nFoo\nFoo::Bar\nFoo::Baz\nInc\n", out