1require 'rdoc/test_case' 2 3class TestRDocGeneratorMarkup < RDoc::TestCase 4 5 include RDoc::Text 6 include RDoc::Generator::Markup 7 8 attr_reader :store 9 10 def setup 11 super 12 13 @options = RDoc::Options.new 14 @rdoc.options = @options 15 16 @parent = self 17 @path = '/index.html' 18 @symbols = {} 19 end 20 21 def test_aref_to 22 assert_equal 'Foo/Bar.html', aref_to('Foo/Bar.html') 23 end 24 25 def test_as_href 26 assert_equal '../index.html', as_href('Foo/Bar.html') 27 end 28 29 def test_cvs_url 30 assert_equal 'http://example/this_page', 31 cvs_url('http://example/', 'this_page') 32 33 assert_equal 'http://example/?page=this_page&foo=bar', 34 cvs_url('http://example/?page=%s&foo=bar', 'this_page') 35 end 36 37 def test_description 38 @comment = '= Hello' 39 40 links = '<span><a href="#label-Hello">¶</a> ' + 41 '<a href="#documentation">↑</a></span>' 42 43 assert_equal "\n<h1 id=\"label-Hello\">Hello#{links}</h1>\n", description 44 end 45 46 def test_formatter 47 assert_kind_of RDoc::Markup::ToHtmlCrossref, formatter 48 refute formatter.show_hash 49 assert_same self, formatter.context 50 end 51 52 attr_reader :path 53 54 def find_symbol name 55 @symbols[name] 56 end 57 58end 59 60