summaryrefslogtreecommitdiff
path: root/test/rdoc/test_rdoc_ri_driver.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rdoc/test_rdoc_ri_driver.rb')
-rw-r--r--test/rdoc/test_rdoc_ri_driver.rb51
1 files changed, 16 insertions, 35 deletions
diff --git a/test/rdoc/test_rdoc_ri_driver.rb b/test/rdoc/test_rdoc_ri_driver.rb
index 87e4ebd2b1..39e6e67759 100644
--- a/test/rdoc/test_rdoc_ri_driver.rb
+++ b/test/rdoc/test_rdoc_ri_driver.rb
@@ -6,17 +6,13 @@ class TestRDocRIDriver < RDoc::TestCase
def setup
super
- @tmpdir = File.join Dir.tmpdir, "test_rdoc_ri_driver_#{$$}"
- @home_ri = File.join @tmpdir, 'dot_ri'
+ @home_ri = File.join @test_home, 'dot_ri'
- FileUtils.mkdir_p @tmpdir
FileUtils.mkdir_p @home_ri
- @orig_ri = ENV['RI']
- ENV['HOME'] = @tmpdir
- @rdoc_home = File.join ENV["HOME"], ".rdoc"
+ @orig_ri = ENV.delete('RI')
+ @rdoc_home = File.join @test_home, ".rdoc"
FileUtils.mkdir_p @rdoc_home
- ENV.delete 'RI'
@options = RDoc::RI::Driver.default_options
@options[:use_system] = false
@@ -24,7 +20,7 @@ class TestRDocRIDriver < RDoc::TestCase
@options[:use_home] = false
@options[:use_gems] = false
- @options[:home] = @tmpdir
+ @options[:home] = @rdoc_home
@options[:use_stdout] = true
@options[:formatter] = @RM::ToRdoc
@@ -32,13 +28,17 @@ class TestRDocRIDriver < RDoc::TestCase
end
def teardown
- ENV['RI'] = @orig_ri
- FileUtils.rm_rf @tmpdir
+ defined?(@orig_ri) and ENV['RI'] = @orig_ri
super
end
- DUMMY_PAGER = ":;\n"
+ case RUBY_PLATFORM
+ when /mswin|mingw/
+ DUMMY_PAGER = "type nul"
+ else
+ DUMMY_PAGER = "true"
+ end
def with_dummy_pager
pager_env, ENV['RI_PAGER'] = ENV['RI_PAGER'], DUMMY_PAGER
@@ -598,7 +598,7 @@ class TestRDocRIDriver < RDoc::TestCase
assert_match %r%^= Attributes:%, out
assert_match %r%^ attr_accessor attr%, out
- assert_equal 1, out.scan(/-\n/).length
+ assert_equal 1, out.scan(/^-{50,}$/).length, out
refute_match %r%Foo::Bar#blah%, out
end
@@ -622,7 +622,7 @@ class TestRDocRIDriver < RDoc::TestCase
assert_match %r%^= Attributes:%, out
assert_match %r%^ attr_accessor attr%, out
- assert_equal 6, out.scan(/-\n/).length
+ assert_equal 6, out.scan(/^-{50,}$/).length, out
assert_match %r%Foo::Bar#blah%, out
end
@@ -1091,23 +1091,6 @@ Foo::Bar#bother
assert_instance_of @RM::ToBs, driver.formatter(StringIO.new)
end
- def test_in_path_eh
- path = ENV['PATH']
-
- test_path = File.expand_path '..', __FILE__
-
- temp_dir do |dir|
- nonexistent = File.join dir, 'nonexistent'
- refute @driver.in_path?(nonexistent)
-
- ENV['PATH'] = test_path
-
- assert @driver.in_path?(File.basename(__FILE__))
- end
- ensure
- ENV['PATH'] = path
- end
-
def test_method_type
assert_equal :both, @driver.method_type(nil)
assert_equal :both, @driver.method_type('.')
@@ -1246,7 +1229,7 @@ Foo::Bar#bother
assert_equal '(unknown)#inherit', method.full_name
end
- def _test_page # this test doesn't do anything anymore :(
+ def test_page
@driver.use_stdout = false
with_dummy_pager do
@@ -1260,9 +1243,7 @@ Foo::Bar#bother
refute @driver.paging?
end
- # this test is too fragile. Perhaps using Process.spawn will make this
- # reliable
- def _test_page_in_presence_of_child_status
+ def test_page_in_presence_of_child_status
@driver.use_stdout = false
with_dummy_pager do
@@ -1425,7 +1406,7 @@ Foo::Bar#bother
end
end
- def _test_setup_pager # this test doesn't do anything anymore :(
+ def test_setup_pager # this test doesn't do anything anymore :(
@driver.use_stdout = false
pager = with_dummy_pager do @driver.setup_pager end