aboutsummaryrefslogtreecommitdiffstats
path: root/test/rdoc/test_rdoc_ri_driver.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-20 03:22:49 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-20 03:22:49 +0000
commit2ef9c50c6e405717d06362787c4549ca4f1c6485 (patch)
treeee99486567461dd5796f3d6edcc9e204187f2666 /test/rdoc/test_rdoc_ri_driver.rb
parentd7effd506f5b91a636f2e6452ef1946b923007c7 (diff)
downloadruby-2ef9c50c6e405717d06362787c4549ca4f1c6485.tar.gz
Import RDoc 3
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rdoc/test_rdoc_ri_driver.rb')
-rw-r--r--test/rdoc/test_rdoc_ri_driver.rb72
1 files changed, 41 insertions, 31 deletions
diff --git a/test/rdoc/test_rdoc_ri_driver.rb b/test/rdoc/test_rdoc_ri_driver.rb
index 9ff89077b6..75ecfefe8e 100644
--- a/test/rdoc/test_rdoc_ri_driver.rb
+++ b/test/rdoc/test_rdoc_ri_driver.rb
@@ -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
- driver = RDoc::RI::Driver.new
-
- io = Object.new
- def io.tty?; false; end
+ tty = Object.new
+ def tty.tty?() true; end
- assert_instance_of @RM::ToBs, driver.formatter(io)
+ driver = RDoc::RI::Driver.new
- def io.tty?; true; end
+ assert_instance_of @RM::ToAnsi, driver.formatter(tty)
- 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