2008-10-24 19:05:28 -04:00
|
|
|
require 'rubygems'
|
2009-07-26 21:25:01 -04:00
|
|
|
require 'test/unit'
|
2008-09-24 22:43:03 -04:00
|
|
|
require 'rdoc/parser'
|
2008-10-24 19:05:28 -04:00
|
|
|
require 'rdoc/parser/ruby'
|
2008-09-24 22:43:03 -04:00
|
|
|
|
2009-07-26 21:25:01 -04:00
|
|
|
class TestRDocParser < Test::Unit::TestCase
|
2008-09-24 22:43:03 -04:00
|
|
|
def test_can_parse
|
|
|
|
assert_equal(RDoc::Parser.can_parse(__FILE__), RDoc::Parser::Ruby)
|
|
|
|
|
|
|
|
readme_file_name = File.join(File.dirname(__FILE__), "..", "README.txt")
|
|
|
|
|
2008-10-24 19:05:28 -04:00
|
|
|
unless File.exist? readme_file_name then # HACK for tests in trunk :/
|
2008-09-24 22:43:03 -04:00
|
|
|
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")
|
2009-07-26 21:25:01 -04:00
|
|
|
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))
|
2008-09-24 22:43:03 -04:00
|
|
|
end
|
|
|
|
end
|
2008-10-24 19:05:28 -04:00
|
|
|
|
|
|
|
MiniTest::Unit.autorun
|