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