diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-01 07:45:16 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-01 07:45:16 +0000 |
commit | 46580b51477355fece514573c88cb67030f4a502 (patch) | |
tree | 779c1a64466643461b3daa4cd9a3548b84f0fd55 /test/rdoc/test_rdoc_rdoc.rb | |
parent | 9b40cdfe8c973a061c5683ad78c283b9ddb8b2e9 (diff) |
Import RDoc 2.5
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rdoc/test_rdoc_rdoc.rb')
-rw-r--r-- | test/rdoc/test_rdoc_rdoc.rb | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/test/rdoc/test_rdoc_rdoc.rb b/test/rdoc/test_rdoc_rdoc.rb new file mode 100644 index 0000000000..91fbe35f85 --- /dev/null +++ b/test/rdoc/test_rdoc_rdoc.rb @@ -0,0 +1,66 @@ +require 'tempfile' +require 'rubygems' +require 'minitest/autorun' +require 'rdoc/rdoc' + +class TestRDocRDoc < MiniTest::Unit::TestCase + + def setup + @rdoc = RDoc::RDoc.new + @tempfile = Tempfile.new 'test_rdoc_rdoc' + end + + def teardown + @tempfile.close + end + + def test_gather_files + assert_equal(%w[lib/rdoc.rb], + @rdoc.gather_files(%w[lib/rdoc.rb lib/rdoc.rb])) + end + + def test_read_file_contents + @tempfile.write "hi everybody" + @tempfile.flush + + assert_equal "hi everybody", @rdoc.read_file_contents(@tempfile.path) + end + + def test_read_file_contents_encoding + skip "Encoding not implemented" unless defined? ::Encoding + + @tempfile.write "# coding: utf-8\nhi everybody" + @tempfile.flush + + contents = @rdoc.read_file_contents @tempfile.path + assert_equal "# coding: utf-8\nhi everybody", contents + assert_equal Encoding::UTF_8, contents.encoding + end + + def test_read_file_contents_encoding_fancy + skip "Encoding not implemented" unless defined? ::Encoding + + @tempfile.write "# -*- coding: utf-8; fill-column: 74 -*-\nhi everybody" + @tempfile.flush + + contents = @rdoc.read_file_contents @tempfile.path + assert_equal("# -*- coding: utf-8; fill-column: 74 -*-\nhi everybody", + contents) + assert_equal Encoding::UTF_8, contents.encoding + end + + def test_remove_unparsable + file_list = %w[ + blah.class + blah.eps + blah.erb + blah.scpt.txt + blah.ttf + blah.yml + ] + + assert_empty @rdoc.remove_unparseable file_list + end + +end + |