diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-27 03:45:22 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-27 03:45:22 +0000 |
commit | 336a8301f725bd8fbf5f1e0c4fee162382a76d0f (patch) | |
tree | 455c5fb8689d09e734a9ca13cdbe3ef9a7651a6e /test/rdoc/test_rdoc_rdoc.rb | |
parent | 3a87c3c5603fce8449f78faccaff5f4be6f372e1 (diff) |
Import RDoc 2.5.7. Fixes #1318 and ruby-core:29780
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rdoc/test_rdoc_rdoc.rb')
-rw-r--r-- | test/rdoc/test_rdoc_rdoc.rb | 55 |
1 files changed, 26 insertions, 29 deletions
diff --git a/test/rdoc/test_rdoc_rdoc.rb b/test/rdoc/test_rdoc_rdoc.rb index 772ba4c3b1..866667c494 100644 --- a/test/rdoc/test_rdoc_rdoc.rb +++ b/test/rdoc/test_rdoc_rdoc.rb @@ -82,50 +82,47 @@ class TestRDocRDoc < MiniTest::Unit::TestCase end def test_setup_output_dir - path = @tempfile.path - @tempfile.unlink + skip "No Dir::mktmpdir, upgrade your ruby" unless Dir.respond_to? :mktmpdir - last = @rdoc.setup_output_dir path, false + Dir.mktmpdir {|d| + path = File.join(d, 'testdir') - assert_empty last + last = @rdoc.setup_output_dir path, false - assert File.directory? path - ensure - FileUtils.rm_f path + assert_empty last + + assert File.directory? path + } end def test_setup_output_dir_exists - path = @tempfile.path - @tempfile.unlink - FileUtils.mkdir_p path + skip "No Dir::mktmpdir, upgrade your ruby" unless Dir.respond_to? :mktmpdir - open @rdoc.output_flag_file(path), 'w' do |io| - io.puts Time.at 0 - io.puts "./lib/rdoc.rb\t#{Time.at 86400}" - end + Dir.mktmpdir {|path| + open @rdoc.output_flag_file(path), 'w' do |io| + io.puts Time.at 0 + io.puts "./lib/rdoc.rb\t#{Time.at 86400}" + end - last = @rdoc.setup_output_dir path, false + last = @rdoc.setup_output_dir path, false - assert_equal 1, last.size - assert_equal Time.at(86400), last['./lib/rdoc.rb'] - ensure - FileUtils.rm_f path + assert_equal 1, last.size + assert_equal Time.at(86400), last['./lib/rdoc.rb'] + } end def test_setup_output_dir_exists_empty_created_rid - path = @tempfile.path - @tempfile.unlink - FileUtils.mkdir_p path + skip "No Dir::mktmpdir, upgrade your ruby" unless Dir.respond_to? :mktmpdir - open @rdoc.output_flag_file(path), 'w' do end + Dir.mktmpdir {|path| + open @rdoc.output_flag_file(path), 'w' do end - e = assert_raises RDoc::Error do - @rdoc.setup_output_dir path, false - end + e = assert_raises RDoc::Error do + @rdoc.setup_output_dir path, false + end - assert_match %r%Directory #{Regexp.escape path} already exists%, e.message - ensure - FileUtils.rm_f path + assert_match %r%Directory #{Regexp.escape path} already exists%, e.message + } end def test_setup_output_dir_exists_file |