From d42d6e690e3f553b971322eae783ac6b0d4d9692 Mon Sep 17 00:00:00 2001 From: hsbt Date: Fri, 5 Sep 2014 01:41:25 +0000 Subject: * lib/rdoc.rb, lib/rdoc, test/rdoc: Update to RDoc 4.2.0.alpha(313287) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/rdoc/test_rdoc_rdoc.rb | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'test/rdoc/test_rdoc_rdoc.rb') 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 -- cgit v1.2.3