diff options
Diffstat (limited to 'test/rdoc/test_rdoc_rdoc.rb')
-rw-r--r-- | test/rdoc/test_rdoc_rdoc.rb | 51 |
1 files changed, 41 insertions, 10 deletions
diff --git a/test/rdoc/test_rdoc_rdoc.rb b/test/rdoc/test_rdoc_rdoc.rb index 0f465d724f..aedccc9dbf 100644 --- a/test/rdoc/test_rdoc_rdoc.rb +++ b/test/rdoc/test_rdoc_rdoc.rb @@ -16,12 +16,27 @@ class TestRDocRDoc < MiniTest::Unit::TestCase @stats = RDoc::Stats.new 0, 0 @rdoc.instance_variable_set :@stats, @stats - - @tempfile = Tempfile.new 'test_rdoc_rdoc' end - def teardown - @tempfile.close rescue nil # HACK for 1.8.6 + def test_class_reset + tl = RDoc::TopLevel.new 'file.rb' + tl.add_class RDoc::NormalClass, 'C' + tl.add_class RDoc::NormalModule, 'M' + + c = RDoc::Parser::C + enclosure_classes = c.send :class_variable_get, :@@enclosure_classes + enclosure_classes['A'] = 'B' + known_bodies = c.send :class_variable_get, :@@known_bodies + known_bodies['A'] = 'B' + + RDoc::RDoc.reset + + assert_empty RDoc::TopLevel.all_classes_hash + assert_empty RDoc::TopLevel.all_files_hash + assert_empty RDoc::TopLevel.all_modules_hash + + assert_empty c.send :class_variable_get, :@@enclosure_classes + assert_empty c.send :class_variable_get, :@@known_bodies end def test_gather_files @@ -47,6 +62,20 @@ class TestRDocRDoc < MiniTest::Unit::TestCase assert_empty files end + def test_parse_file_encoding + skip "Encoding not implemented" unless Object.const_defined? :Encoding + @rdoc.options.encoding = Encoding::ISO_8859_1 + + 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 + end + end + def test_remove_unparseable file_list = %w[ blah.class @@ -120,14 +149,16 @@ class TestRDocRDoc < MiniTest::Unit::TestCase end def test_setup_output_dir_exists_file - path = @tempfile.path + Tempfile.open 'test_rdoc_rdoc' do |tempfile| + path = tempfile.path - 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%#{Regexp.escape path} exists and is not a directory%, - e.message) + assert_match(%r%#{Regexp.escape path} exists and is not a directory%, + e.message) + end end def test_setup_output_dir_exists_not_rdoc |