1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/rdoc/test_rdoc_parser.rb
nobu 1ac307dddc * lib/rdoc/parser.rb (RDoc::Parser.binary?): fix for empty files.
[ruby-dev:38848]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-27 01:25:01 +00:00

25 lines
840 B
Ruby

require 'rubygems'
require 'test/unit'
require 'rdoc/parser'
require 'rdoc/parser/ruby'
class TestRDocParser < Test::Unit::TestCase
def test_can_parse
assert_equal(RDoc::Parser.can_parse(__FILE__), RDoc::Parser::Ruby)
readme_file_name = File.join(File.dirname(__FILE__), "..", "README.txt")
unless File.exist? readme_file_name then # HACK for tests in trunk :/
readme_file_name = File.join File.dirname(__FILE__), '..', '..', 'README'
end
assert_equal(RDoc::Parser.can_parse(readme_file_name), RDoc::Parser::Simple)
binary_file_name = File.join(File.dirname(__FILE__), "binary.dat")
assert_nil(RDoc::Parser.can_parse(binary_file_name))
empty_file_name = File.join(File.dirname(__FILE__), "empty.dat")
assert_not_nil(RDoc::Parser.can_parse(empty_file_name))
end
end
MiniTest::Unit.autorun