aboutsummaryrefslogtreecommitdiffstats
path: root/test/rdoc/test_rdoc_rdoc.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rdoc/test_rdoc_rdoc.rb')
-rw-r--r--test/rdoc/test_rdoc_rdoc.rb27
1 files changed, 24 insertions, 3 deletions
diff --git a/test/rdoc/test_rdoc_rdoc.rb b/test/rdoc/test_rdoc_rdoc.rb
index 8b349a4389..2adfdcc460 100644
--- a/test/rdoc/test_rdoc_rdoc.rb
+++ b/test/rdoc/test_rdoc_rdoc.rb
@@ -252,14 +252,16 @@ class TestRDocRDoc < RDoc::TestCase
@rdoc.options.encoding = Encoding::ISO_8859_1
@rdoc.store = RDoc::Store.new
- Tempfile.create 'test.txt' do |io|
+ tf = Tempfile.open 'test.txt' do |io|
io.write 'hi'
io.rewind
top_level = @rdoc.parse_file io.path
assert_equal Encoding::ISO_8859_1, top_level.absolute_name.encoding
+ io
end
+ tf.close! if tf.respond_to? :close?
end
def test_parse_file_forbidden
@@ -267,7 +269,7 @@ class TestRDocRDoc < RDoc::TestCase
@rdoc.store = RDoc::Store.new
- Tempfile.create 'test.txt' do |io|
+ tf = Tempfile.open 'test.txt' do |io|
io.write 'hi'
io.rewind
@@ -286,7 +288,9 @@ class TestRDocRDoc < RDoc::TestCase
ensure
File.chmod 0400, io.path
end
+ io
end
+ tf.close! if tf.respond_to? :close!
end
def test_remove_unparseable
@@ -382,7 +386,7 @@ class TestRDocRDoc < RDoc::TestCase
end
def test_setup_output_dir_exists_file
- Tempfile.create 'test_rdoc_rdoc' do |tempfile|
+ tf = Tempfile.open 'test_rdoc_rdoc' do |tempfile|
path = tempfile.path
e = assert_raises RDoc::Error do
@@ -391,7 +395,9 @@ class TestRDocRDoc < RDoc::TestCase
assert_match(%r%#{Regexp.escape path} exists and is not a directory%,
e.message)
+ tempfile
end
+ tf.close! if tf.respond_to? :close!
end
def test_setup_output_dir_exists_not_rdoc
@@ -430,5 +436,20 @@ class TestRDocRDoc < RDoc::TestCase
end
end
+ def test_normalized_file_list_removes_created_rid_dir
+ temp_dir do |d|
+ FileUtils.mkdir "doc"
+ flag_file = @rdoc.output_flag_file "doc"
+ file = File.join "doc", "test"
+ FileUtils.touch flag_file
+ FileUtils.touch file
+
+ file_list = ["doc"]
+
+ output = @rdoc.normalized_file_list file_list
+
+ assert_empty output
+ end
+ end
end