2017-11-27 05:45:24 -05:00
|
|
|
# frozen_string_literal: true
|
2019-08-08 10:09:24 -04:00
|
|
|
require_relative 'helper'
|
2012-11-26 23:28:14 -05:00
|
|
|
|
|
|
|
class TestRDocGeneratorMarkup < RDoc::TestCase
|
|
|
|
|
|
|
|
include RDoc::Text
|
|
|
|
include RDoc::Generator::Markup
|
|
|
|
|
|
|
|
attr_reader :store
|
|
|
|
|
|
|
|
def setup
|
|
|
|
super
|
|
|
|
|
|
|
|
@options = RDoc::Options.new
|
|
|
|
@rdoc.options = @options
|
|
|
|
|
|
|
|
@parent = self
|
|
|
|
@path = '/index.html'
|
|
|
|
@symbols = {}
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_aref_to
|
|
|
|
assert_equal 'Foo/Bar.html', aref_to('Foo/Bar.html')
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_as_href
|
|
|
|
assert_equal '../index.html', as_href('Foo/Bar.html')
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_cvs_url
|
|
|
|
assert_equal 'http://example/this_page',
|
|
|
|
cvs_url('http://example/', 'this_page')
|
|
|
|
|
|
|
|
assert_equal 'http://example/?page=this_page&foo=bar',
|
|
|
|
cvs_url('http://example/?page=%s&foo=bar', 'this_page')
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_description
|
|
|
|
@comment = '= Hello'
|
|
|
|
|
2012-12-19 22:57:08 -05:00
|
|
|
links = '<span><a href="#label-Hello">¶</a> ' +
|
2014-12-06 20:22:37 -05:00
|
|
|
'<a href="#top">↑</a></span>'
|
2012-12-19 22:57:08 -05:00
|
|
|
|
|
|
|
assert_equal "\n<h1 id=\"label-Hello\">Hello#{links}</h1>\n", description
|
2012-11-26 23:28:14 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_formatter
|
|
|
|
assert_kind_of RDoc::Markup::ToHtmlCrossref, formatter
|
|
|
|
refute formatter.show_hash
|
|
|
|
assert_same self, formatter.context
|
|
|
|
end
|
|
|
|
|
|
|
|
attr_reader :path
|
|
|
|
|
|
|
|
def find_symbol name
|
|
|
|
@symbols[name]
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|