require 'rubygems' require 'rdoc/markup/formatter_test_case' require 'rdoc/markup/to_html' require 'minitest/autorun' class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase add_visitor_tests def setup super @to = RDoc::Markup::ToHtml.new end def test_class_gen_relative_url def gen(from, to) RDoc::Markup::ToHtml.gen_relative_url from, to end assert_equal 'a.html', gen('a.html', 'a.html') assert_equal 'b.html', gen('a.html', 'b.html') assert_equal 'd.html', gen('a/c.html', 'a/d.html') assert_equal '../a.html', gen('a/c.html', 'a.html') assert_equal 'a/c.html', gen('a.html', 'a/c.html') end def accept_blank_line assert_empty @to.res.join end def accept_document assert_equal "\n

hello

\n", @to.res.join end def accept_heading assert_equal "\n
Hello
\n", @to.res.join end def accept_heading_1 assert_equal "\n

Hello

\n", @to.res.join end def accept_heading_2 assert_equal "\n

Hello

\n", @to.res.join end def accept_heading_3 assert_equal "\n

Hello

\n", @to.res.join end def accept_heading_4 assert_equal "\n

Hello

\n", @to.res.join end def accept_heading_b assert_equal "\n

Hello

\n", @to.res.join end def accept_heading_suppressed_crossref assert_equal "\n

Hello

\n", @to.res.join end def accept_list_end_bullet assert_equal [], @to.list assert_equal [], @to.in_list_entry assert_equal "\n", @to.res.join end def accept_list_end_label assert_equal [], @to.list assert_equal [], @to.in_list_entry assert_equal "
\n", @to.res.join end def accept_list_end_lalpha assert_equal [], @to.list assert_equal [], @to.in_list_entry assert_equal "
    \n", @to.res.join end def accept_list_end_number assert_equal [], @to.list assert_equal [], @to.in_list_entry assert_equal "
      \n", @to.res.join end def accept_list_end_note assert_equal [], @to.list assert_equal [], @to.in_list_entry assert_equal "
      \n", @to.res.join end def accept_list_end_ualpha assert_equal [], @to.list assert_equal [], @to.in_list_entry assert_equal "
        \n", @to.res.join end def accept_list_item_end_bullet assert_equal %w[], @to.in_list_entry end def accept_list_item_end_label assert_equal %w[], @to.in_list_entry end def accept_list_item_end_lalpha assert_equal %w[], @to.in_list_entry end def accept_list_item_end_note assert_equal %w[], @to.in_list_entry end def accept_list_item_end_number assert_equal %w[], @to.in_list_entry end def accept_list_item_end_ualpha assert_equal %w[], @to.in_list_entry end def accept_list_item_start_bullet assert_equal "