2017-11-27 05:45:24 -05:00
|
|
|
# frozen_string_literal: true
|
2019-08-08 10:09:24 -04:00
|
|
|
require_relative 'helper'
|
2008-07-17 20:46:16 -04:00
|
|
|
|
2010-04-01 03:45:16 -04:00
|
|
|
class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
|
|
|
|
|
|
|
|
add_visitor_tests
|
2008-07-17 20:46:16 -04:00
|
|
|
|
|
|
|
def setup
|
2010-04-01 03:45:16 -04:00
|
|
|
super
|
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
@to = RDoc::Markup::ToHtml.new @options
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_blank_line
|
|
|
|
assert_empty @to.res.join
|
|
|
|
end
|
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
def accept_block_quote
|
|
|
|
assert_equal "\n<blockquote>\n<p>quote</p>\n</blockquote>\n", @to.res.join
|
|
|
|
end
|
|
|
|
|
2011-06-16 00:59:24 -04:00
|
|
|
def accept_document
|
|
|
|
assert_equal "\n<p>hello</p>\n", @to.res.join
|
|
|
|
end
|
|
|
|
|
2010-04-01 03:45:16 -04:00
|
|
|
def accept_heading
|
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
|
|
|
expected = "\n<h5 id=\"label-Hello\">Hello#{links}</h5>\n"
|
|
|
|
|
|
|
|
assert_equal expected, @to.res.join
|
2010-12-19 22:22:49 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_heading_1
|
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", @to.res.join
|
2010-12-19 22:22:49 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_heading_2
|
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<h2 id=\"label-Hello\">Hello#{links}</h2>\n", @to.res.join
|
2010-12-19 22:22:49 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_heading_3
|
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<h3 id=\"label-Hello\">Hello#{links}</h3>\n", @to.res.join
|
2010-12-19 22:22:49 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_heading_4
|
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<h4 id=\"label-Hello\">Hello#{links}</h4>\n", @to.res.join
|
2010-12-19 22:22:49 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_heading_b
|
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
|
|
|
inner = "<strong>Hello</strong>"
|
|
|
|
|
|
|
|
assert_equal "\n<h1 id=\"label-Hello\">#{inner}#{links}</h1>\n",
|
2012-11-26 23:28:14 -05:00
|
|
|
@to.res.join
|
2010-12-19 22:22:49 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_heading_suppressed_crossref
|
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", @to.res.join
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_list_end_bullet
|
|
|
|
assert_equal [], @to.list
|
|
|
|
assert_equal [], @to.in_list_entry
|
|
|
|
|
2010-12-19 22:22:49 -05:00
|
|
|
assert_equal "<ul></ul>\n", @to.res.join
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_list_end_label
|
|
|
|
assert_equal [], @to.list
|
|
|
|
assert_equal [], @to.in_list_entry
|
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
assert_equal "<dl class=\"rdoc-list label-list\"></dl>\n", @to.res.join
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_list_end_lalpha
|
|
|
|
assert_equal [], @to.list
|
|
|
|
assert_equal [], @to.in_list_entry
|
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
assert_equal "<ol style=\"list-style-type: lower-alpha\"></ol>\n", @to.res.join
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_list_end_number
|
|
|
|
assert_equal [], @to.list
|
|
|
|
assert_equal [], @to.in_list_entry
|
|
|
|
|
2010-12-19 22:22:49 -05:00
|
|
|
assert_equal "<ol></ol>\n", @to.res.join
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_list_end_note
|
|
|
|
assert_equal [], @to.list
|
|
|
|
assert_equal [], @to.in_list_entry
|
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
assert_equal "<dl class=\"rdoc-list note-list\"></dl>\n", @to.res.join
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_list_end_ualpha
|
|
|
|
assert_equal [], @to.list
|
|
|
|
assert_equal [], @to.in_list_entry
|
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
assert_equal "<ol style=\"list-style-type: upper-alpha\"></ol>\n", @to.res.join
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_list_item_end_bullet
|
|
|
|
assert_equal %w[</li>], @to.in_list_entry
|
|
|
|
end
|
|
|
|
|
|
|
|
def accept_list_item_end_label
|
|
|
|
assert_equal %w[</dd>], @to.in_list_entry
|
|
|
|
end
|
|
|
|
|
|
|
|
def accept_list_item_end_lalpha
|
|
|
|
assert_equal %w[</li>], @to.in_list_entry
|
|
|
|
end
|
|
|
|
|
|
|
|
def accept_list_item_end_note
|
2012-11-26 23:28:14 -05:00
|
|
|
assert_equal %w[</dd>], @to.in_list_entry
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_list_item_end_number
|
|
|
|
assert_equal %w[</li>], @to.in_list_entry
|
|
|
|
end
|
|
|
|
|
|
|
|
def accept_list_item_end_ualpha
|
|
|
|
assert_equal %w[</li>], @to.in_list_entry
|
|
|
|
end
|
|
|
|
|
|
|
|
def accept_list_item_start_bullet
|
2010-12-19 22:22:49 -05:00
|
|
|
assert_equal "<ul><li>", @to.res.join
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_list_item_start_label
|
2012-11-26 23:28:14 -05:00
|
|
|
assert_equal "<dl class=\"rdoc-list label-list\"><dt>cat\n<dd>", @to.res.join
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_list_item_start_lalpha
|
2012-11-26 23:28:14 -05:00
|
|
|
assert_equal "<ol style=\"list-style-type: lower-alpha\"><li>", @to.res.join
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_list_item_start_note
|
2012-11-26 23:28:14 -05:00
|
|
|
assert_equal "<dl class=\"rdoc-list note-list\"><dt>cat\n<dd>",
|
2010-12-19 22:22:49 -05:00
|
|
|
@to.res.join
|
|
|
|
end
|
|
|
|
|
|
|
|
def accept_list_item_start_note_2
|
|
|
|
expected = <<-EXPECTED
|
2012-11-26 23:28:14 -05:00
|
|
|
<dl class="rdoc-list note-list"><dt><code>teletype</code>
|
|
|
|
<dd>
|
2010-12-19 22:22:49 -05:00
|
|
|
<p>teletype description</p>
|
2012-11-26 23:28:14 -05:00
|
|
|
</dd></dl>
|
|
|
|
EXPECTED
|
|
|
|
|
|
|
|
assert_equal expected, @to.res.join
|
|
|
|
end
|
|
|
|
|
|
|
|
def accept_list_item_start_note_multi_description
|
|
|
|
expected = <<-EXPECTED
|
|
|
|
<dl class="rdoc-list note-list"><dt>label
|
|
|
|
<dd>
|
|
|
|
<p>description one</p>
|
|
|
|
</dd><dd>
|
|
|
|
<p>description two</p>
|
|
|
|
</dd></dl>
|
|
|
|
EXPECTED
|
|
|
|
|
|
|
|
assert_equal expected, @to.res.join
|
|
|
|
end
|
|
|
|
|
|
|
|
def accept_list_item_start_note_multi_label
|
|
|
|
expected = <<-EXPECTED
|
|
|
|
<dl class="rdoc-list note-list"><dt>one
|
|
|
|
<dt>two
|
|
|
|
<dd>
|
|
|
|
<p>two headers</p>
|
|
|
|
</dd></dl>
|
2010-12-19 22:22:49 -05:00
|
|
|
EXPECTED
|
|
|
|
|
|
|
|
assert_equal expected, @to.res.join
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_list_item_start_number
|
2010-12-19 22:22:49 -05:00
|
|
|
assert_equal "<ol><li>", @to.res.join
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_list_item_start_ualpha
|
2012-11-26 23:28:14 -05:00
|
|
|
assert_equal "<ol style=\"list-style-type: upper-alpha\"><li>", @to.res.join
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_list_start_bullet
|
|
|
|
assert_equal [:BULLET], @to.list
|
|
|
|
assert_equal [false], @to.in_list_entry
|
|
|
|
|
2010-12-19 22:22:49 -05:00
|
|
|
assert_equal "<ul>", @to.res.join
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_list_start_label
|
|
|
|
assert_equal [:LABEL], @to.list
|
|
|
|
assert_equal [false], @to.in_list_entry
|
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
assert_equal '<dl class="rdoc-list label-list">', @to.res.join
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_list_start_lalpha
|
|
|
|
assert_equal [:LALPHA], @to.list
|
|
|
|
assert_equal [false], @to.in_list_entry
|
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
assert_equal "<ol style=\"list-style-type: lower-alpha\">", @to.res.join
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_list_start_note
|
|
|
|
assert_equal [:NOTE], @to.list
|
|
|
|
assert_equal [false], @to.in_list_entry
|
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
assert_equal "<dl class=\"rdoc-list note-list\">", @to.res.join
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_list_start_number
|
|
|
|
assert_equal [:NUMBER], @to.list
|
|
|
|
assert_equal [false], @to.in_list_entry
|
|
|
|
|
2010-12-19 22:22:49 -05:00
|
|
|
assert_equal "<ol>", @to.res.join
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_list_start_ualpha
|
|
|
|
assert_equal [:UALPHA], @to.list
|
|
|
|
assert_equal [false], @to.in_list_entry
|
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
assert_equal "<ol style=\"list-style-type: upper-alpha\">", @to.res.join
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_paragraph
|
2010-12-19 22:22:49 -05:00
|
|
|
assert_equal "\n<p>hi</p>\n", @to.res.join
|
|
|
|
end
|
|
|
|
|
|
|
|
def accept_paragraph_b
|
2012-11-26 23:28:14 -05:00
|
|
|
assert_equal "\n<p>reg <strong>bold words</strong> reg</p>\n", @to.res.join
|
|
|
|
end
|
|
|
|
|
|
|
|
def accept_paragraph_br
|
|
|
|
assert_equal "\n<p>one<br>two</p>\n", @to.res.join
|
|
|
|
end
|
|
|
|
|
|
|
|
def accept_paragraph_break
|
2013-09-18 19:33:36 -04:00
|
|
|
assert_equal "\n<p>hello<br> world</p>\n", @to.res.join
|
2010-12-19 22:22:49 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_paragraph_i
|
|
|
|
assert_equal "\n<p>reg <em>italic words</em> reg</p>\n", @to.res.join
|
|
|
|
end
|
|
|
|
|
|
|
|
def accept_paragraph_plus
|
2012-11-26 23:28:14 -05:00
|
|
|
assert_equal "\n<p>reg <code>teletype</code> reg</p>\n", @to.res.join
|
2010-12-19 22:22:49 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_paragraph_star
|
2012-11-26 23:28:14 -05:00
|
|
|
assert_equal "\n<p>reg <strong>bold</strong> reg</p>\n", @to.res.join
|
2010-12-19 22:22:49 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_paragraph_underscore
|
|
|
|
assert_equal "\n<p>reg <em>italic</em> reg</p>\n", @to.res.join
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
2010-04-26 23:45:22 -04:00
|
|
|
def accept_raw
|
|
|
|
raw = <<-RAW.rstrip
|
|
|
|
<table>
|
|
|
|
<tr><th>Name<th>Count
|
|
|
|
<tr><td>a<td>1
|
|
|
|
<tr><td>b<td>2
|
|
|
|
</table>
|
|
|
|
RAW
|
|
|
|
|
|
|
|
assert_equal raw, @to.res.join
|
|
|
|
end
|
|
|
|
|
2010-04-01 03:45:16 -04:00
|
|
|
def accept_rule
|
2013-09-18 19:33:36 -04:00
|
|
|
assert_equal "<hr>\n", @to.res.join
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept_verbatim
|
2014-12-06 20:22:37 -05:00
|
|
|
assert_equal "\n<pre class=\"ruby\"><span class=\"ruby-identifier\">hi</span>\n <span class=\"ruby-identifier\">world</span>\n</pre>\n", @to.res.join
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def end_accepting
|
|
|
|
assert_equal 'hi', @to.end_accepting
|
|
|
|
end
|
|
|
|
|
|
|
|
def start_accepting
|
|
|
|
assert_equal [], @to.res
|
|
|
|
assert_equal [], @to.in_list_entry
|
|
|
|
assert_equal [], @to.list
|
|
|
|
end
|
|
|
|
|
2010-12-19 22:22:49 -05:00
|
|
|
def list_nested
|
2010-04-01 03:45:16 -04:00
|
|
|
expected = <<-EXPECTED
|
2010-12-19 22:22:49 -05:00
|
|
|
<ul><li>
|
|
|
|
<p>l1</p>
|
|
|
|
<ul><li>
|
|
|
|
<p>l1.1</p>
|
|
|
|
</li></ul>
|
|
|
|
</li><li>
|
|
|
|
<p>l2</p>
|
|
|
|
</li></ul>
|
2010-04-01 03:45:16 -04:00
|
|
|
EXPECTED
|
|
|
|
|
2010-12-19 22:22:49 -05:00
|
|
|
assert_equal expected, @to.res.join
|
2008-07-17 20:46:16 -04:00
|
|
|
end
|
|
|
|
|
2010-12-19 22:22:49 -05:00
|
|
|
def list_verbatim
|
|
|
|
expected = <<-EXPECTED
|
|
|
|
<ul><li>
|
|
|
|
<p>list stuff</p>
|
|
|
|
|
|
|
|
<pre>* list
|
|
|
|
with
|
|
|
|
|
|
|
|
second
|
|
|
|
|
|
|
|
1. indented
|
|
|
|
2. numbered
|
2010-04-01 03:45:16 -04:00
|
|
|
|
2010-12-19 22:22:49 -05:00
|
|
|
third
|
|
|
|
|
|
|
|
* second</pre>
|
|
|
|
</li></ul>
|
|
|
|
EXPECTED
|
|
|
|
|
|
|
|
assert_equal expected, @to.end_accepting
|
2008-07-17 20:46:16 -04:00
|
|
|
end
|
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
def test_accept_heading_7
|
|
|
|
@to.start_accepting
|
|
|
|
|
|
|
|
@to.accept_heading @RM::Heading.new(7, '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<h6 id=\"label-Hello\">Hello#{links}</h6>\n", @to.res.join
|
2012-11-26 23:28:14 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_accept_heading_aref_class
|
|
|
|
@to.code_object = RDoc::NormalClass.new 'Foo'
|
|
|
|
@to.start_accepting
|
|
|
|
|
2013-09-18 19:33:36 -04:00
|
|
|
@to.accept_heading head(1, 'Hello')
|
2012-11-26 23:28:14 -05:00
|
|
|
|
2013-09-18 19:33:36 -04:00
|
|
|
links = '<span><a href="#class-Foo-label-Hello">¶</a> ' +
|
2014-12-06 20:22:37 -05:00
|
|
|
'<a href="#top">↑</a></span>'
|
2012-12-19 22:57:08 -05:00
|
|
|
|
2013-09-18 19:33:36 -04:00
|
|
|
assert_equal "\n<h1 id=\"class-Foo-label-Hello\">Hello#{links}</h1>\n",
|
2012-11-26 23:28:14 -05:00
|
|
|
@to.res.join
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_accept_heading_aref_method
|
|
|
|
@to.code_object = RDoc::AnyMethod.new nil, 'foo'
|
|
|
|
@to.start_accepting
|
|
|
|
|
|
|
|
@to.accept_heading @RM::Heading.new(1, 'Hello')
|
|
|
|
|
2012-12-19 22:57:08 -05:00
|
|
|
links = '<span><a href="#method-i-foo-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=\"method-i-foo-label-Hello\">Hello#{links}</h1>\n",
|
2012-11-26 23:28:14 -05:00
|
|
|
@to.res.join
|
|
|
|
end
|
|
|
|
|
2012-12-19 22:57:08 -05:00
|
|
|
def test_accept_heading_pipe
|
|
|
|
@options.pipe = true
|
|
|
|
|
|
|
|
@to.start_accepting
|
|
|
|
|
|
|
|
@to.accept_heading @RM::Heading.new(1, 'Hello')
|
|
|
|
|
|
|
|
assert_equal "\n<h1 id=\"label-Hello\">Hello</h1>\n", @to.res.join
|
|
|
|
end
|
|
|
|
|
2013-09-18 19:33:36 -04:00
|
|
|
def test_accept_paragraph_newline
|
|
|
|
@to.start_accepting
|
|
|
|
|
|
|
|
@to.accept_paragraph para("hello\n", "world\n")
|
|
|
|
|
2018-10-17 02:28:20 -04:00
|
|
|
assert_equal "\n<p>hello world </p>\n", @to.res.join
|
2013-09-18 19:33:36 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_accept_heading_output_decoration
|
|
|
|
@options.output_decoration = false
|
|
|
|
|
|
|
|
@to.start_accepting
|
|
|
|
|
|
|
|
@to.accept_heading @RM::Heading.new(1, 'Hello')
|
|
|
|
|
2014-12-06 20:22:37 -05:00
|
|
|
assert_equal "\n<h1>Hello<span><a href=\"#label-Hello\">¶</a> <a href=\"#top\">↑</a></span></h1>\n", @to.res.join
|
2013-09-18 19:33:36 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_accept_heading_output_decoration_with_pipe
|
|
|
|
@options.pipe = true
|
|
|
|
@options.output_decoration = false
|
|
|
|
|
|
|
|
@to.start_accepting
|
|
|
|
|
|
|
|
@to.accept_heading @RM::Heading.new(1, 'Hello')
|
|
|
|
|
|
|
|
assert_equal "\n<h1>Hello</h1>\n", @to.res.join
|
|
|
|
end
|
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
def test_accept_verbatim_parseable
|
|
|
|
verb = @RM::Verbatim.new("class C\n", "end\n")
|
|
|
|
|
|
|
|
@to.start_accepting
|
|
|
|
@to.accept_verbatim verb
|
|
|
|
|
|
|
|
expected = <<-EXPECTED
|
|
|
|
|
|
|
|
<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">C</span>
|
|
|
|
<span class="ruby-keyword">end</span>
|
|
|
|
</pre>
|
|
|
|
EXPECTED
|
|
|
|
|
|
|
|
assert_equal expected, @to.res.join
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_accept_verbatim_parseable_error
|
|
|
|
verb = @RM::Verbatim.new("a % 09 # => blah\n")
|
|
|
|
|
|
|
|
@to.start_accepting
|
|
|
|
@to.accept_verbatim verb
|
|
|
|
|
|
|
|
inner = CGI.escapeHTML "a % 09 # => blah"
|
|
|
|
|
|
|
|
expected = <<-EXPECTED
|
|
|
|
|
2014-12-06 20:22:37 -05:00
|
|
|
<pre>#{inner}</pre>
|
2012-11-26 23:28:14 -05:00
|
|
|
EXPECTED
|
|
|
|
|
|
|
|
assert_equal expected, @to.res.join
|
|
|
|
end
|
|
|
|
|
2017-08-29 07:52:50 -04:00
|
|
|
def test_accept_verbatim_nl_after_backslash
|
|
|
|
verb = @RM::Verbatim.new("a = 1 if first_flag_var and \\\n", " this_is_flag_var\n")
|
|
|
|
|
|
|
|
@to.start_accepting
|
|
|
|
@to.accept_verbatim verb
|
|
|
|
|
|
|
|
expected = <<-EXPECTED
|
|
|
|
|
|
|
|
<pre class="ruby"><span class="ruby-identifier">a</span> = <span class="ruby-value">1</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">first_flag_var</span> <span class="ruby-keyword">and</span> \\
|
|
|
|
<span class="ruby-identifier">this_is_flag_var</span>
|
|
|
|
</pre>
|
|
|
|
EXPECTED
|
|
|
|
|
|
|
|
assert_equal expected, @to.res.join
|
|
|
|
end
|
|
|
|
|
2013-09-18 19:33:36 -04:00
|
|
|
def test_accept_verbatim_pipe
|
|
|
|
@options.pipe = true
|
|
|
|
|
|
|
|
verb = @RM::Verbatim.new("1 + 1\n")
|
|
|
|
verb.format = :ruby
|
|
|
|
|
|
|
|
@to.start_accepting
|
|
|
|
@to.accept_verbatim verb
|
|
|
|
|
|
|
|
expected = <<-EXPECTED
|
|
|
|
|
|
|
|
<pre><code>1 + 1
|
|
|
|
</code></pre>
|
|
|
|
EXPECTED
|
|
|
|
|
|
|
|
assert_equal expected, @to.res.join
|
|
|
|
end
|
|
|
|
|
2017-08-29 07:52:50 -04:00
|
|
|
def test_accept_verbatim_escape_in_string
|
|
|
|
code = <<-'RUBY'
|
|
|
|
def foo
|
|
|
|
[
|
|
|
|
'\\',
|
|
|
|
'\'',
|
|
|
|
"'",
|
|
|
|
"\'\"\`",
|
|
|
|
"\#",
|
|
|
|
"\#{}",
|
|
|
|
"#",
|
|
|
|
"#{}",
|
|
|
|
/'"/,
|
|
|
|
/\'\"/,
|
|
|
|
/\//,
|
|
|
|
/\\/,
|
|
|
|
/\#/,
|
|
|
|
/\#{}/,
|
|
|
|
/#/,
|
|
|
|
/#{}/
|
|
|
|
]
|
|
|
|
end
|
|
|
|
def bar
|
|
|
|
end
|
|
|
|
RUBY
|
|
|
|
verb = @RM::Verbatim.new(*code.split(/(?<=\n)/))
|
|
|
|
|
|
|
|
@to.start_accepting
|
|
|
|
@to.accept_verbatim verb
|
|
|
|
|
|
|
|
expected = <<-'EXPECTED'
|
|
|
|
|
2017-11-27 05:45:24 -05:00
|
|
|
<pre class="ruby"><span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">foo</span>
|
2017-08-29 07:52:50 -04:00
|
|
|
[
|
|
|
|
<span class="ruby-string">'\\'</span>,
|
|
|
|
<span class="ruby-string">'\''</span>,
|
|
|
|
<span class="ruby-string">"'"</span>,
|
|
|
|
<span class="ruby-string">"\'\"\`"</span>,
|
|
|
|
<span class="ruby-string">"\#"</span>,
|
|
|
|
<span class="ruby-string">"\#{}"</span>,
|
|
|
|
<span class="ruby-string">"#"</span>,
|
|
|
|
<span class="ruby-node">"#{}"</span>,
|
|
|
|
<span class="ruby-regexp">/'"/</span>,
|
|
|
|
<span class="ruby-regexp">/\'\"/</span>,
|
|
|
|
<span class="ruby-regexp">/\//</span>,
|
|
|
|
<span class="ruby-regexp">/\\/</span>,
|
|
|
|
<span class="ruby-regexp">/\#/</span>,
|
|
|
|
<span class="ruby-regexp">/\#{}/</span>,
|
|
|
|
<span class="ruby-regexp">/#/</span>,
|
|
|
|
<span class="ruby-regexp">/#{}/</span>
|
|
|
|
]
|
|
|
|
<span class="ruby-keyword">end</span>
|
2017-11-27 05:45:24 -05:00
|
|
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">bar</span>
|
2017-08-29 07:52:50 -04:00
|
|
|
<span class="ruby-keyword">end</span>
|
|
|
|
</pre>
|
|
|
|
EXPECTED
|
|
|
|
|
|
|
|
assert_equal expected, @to.res.join
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_accept_verbatim_escape_in_backtick
|
|
|
|
code = <<-'RUBY'
|
|
|
|
def foo
|
|
|
|
[
|
|
|
|
`\\`,
|
|
|
|
`\'\"\``,
|
|
|
|
`\#`,
|
|
|
|
`\#{}`,
|
|
|
|
`#`,
|
|
|
|
`#{}`
|
|
|
|
]
|
|
|
|
end
|
|
|
|
def bar
|
|
|
|
end
|
|
|
|
RUBY
|
|
|
|
verb = @RM::Verbatim.new(*code.split(/(?<=\n)/))
|
|
|
|
|
|
|
|
@to.start_accepting
|
|
|
|
@to.accept_verbatim verb
|
|
|
|
|
|
|
|
expected = <<-'EXPECTED'
|
|
|
|
|
2017-11-27 05:45:24 -05:00
|
|
|
<pre class="ruby"><span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">foo</span>
|
2017-08-29 07:52:50 -04:00
|
|
|
[
|
|
|
|
<span class="ruby-string">`\\`</span>,
|
|
|
|
<span class="ruby-string">`\'\"\``</span>,
|
|
|
|
<span class="ruby-string">`\#`</span>,
|
|
|
|
<span class="ruby-string">`\#{}`</span>,
|
|
|
|
<span class="ruby-string">`#`</span>,
|
|
|
|
<span class="ruby-node">`#{}`</span>
|
|
|
|
]
|
|
|
|
<span class="ruby-keyword">end</span>
|
2017-11-27 05:45:24 -05:00
|
|
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">bar</span>
|
2017-08-29 07:52:50 -04:00
|
|
|
<span class="ruby-keyword">end</span>
|
|
|
|
</pre>
|
|
|
|
EXPECTED
|
|
|
|
|
|
|
|
assert_equal expected, @to.res.join
|
|
|
|
end
|
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
def test_accept_verbatim_ruby
|
|
|
|
verb = @RM::Verbatim.new("1 + 1\n")
|
|
|
|
verb.format = :ruby
|
|
|
|
|
|
|
|
@to.start_accepting
|
|
|
|
@to.accept_verbatim verb
|
|
|
|
|
|
|
|
expected = <<-EXPECTED
|
|
|
|
|
|
|
|
<pre class="ruby"><span class="ruby-value">1</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
|
|
|
|
</pre>
|
|
|
|
EXPECTED
|
|
|
|
|
|
|
|
assert_equal expected, @to.res.join
|
|
|
|
end
|
|
|
|
|
2017-08-29 07:52:50 -04:00
|
|
|
def test_accept_verbatim_redefinable_operators
|
|
|
|
functions = %w[| ^ & <=> == === =~ > >= < <= << >> + - * / % ** ~ +@ -@ [] []= ` ! != !~].map { |redefinable_op|
|
|
|
|
["def #{redefinable_op}\n", "end\n"]
|
|
|
|
}.flatten
|
|
|
|
|
|
|
|
verb = @RM::Verbatim.new(*functions)
|
|
|
|
|
|
|
|
@to.start_accepting
|
|
|
|
@to.accept_verbatim verb
|
|
|
|
|
|
|
|
expected = <<-EXPECTED
|
|
|
|
|
|
|
|
<pre class="ruby">
|
|
|
|
EXPECTED
|
|
|
|
expected = expected.rstrip
|
|
|
|
|
|
|
|
%w[| ^ & <=> == === =~ > >= < <= << >> + - * / % ** ~ +@ -@ [] []= ` ! != !~].each do |html_escaped_op|
|
|
|
|
expected += <<-EXPECTED
|
2017-11-27 05:45:24 -05:00
|
|
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">#{html_escaped_op}</span>
|
2017-08-29 07:52:50 -04:00
|
|
|
<span class="ruby-keyword">end</span>
|
|
|
|
EXPECTED
|
|
|
|
end
|
|
|
|
|
|
|
|
expected += <<-EXPECTED
|
|
|
|
</pre>
|
|
|
|
EXPECTED
|
|
|
|
|
|
|
|
assert_equal expected, @to.res.join
|
|
|
|
end
|
|
|
|
|
2010-12-19 22:22:49 -05:00
|
|
|
def test_convert_string
|
|
|
|
assert_equal '<>', @to.convert_string('<>')
|
|
|
|
end
|
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
def test_convert_HYPERLINK_irc
|
|
|
|
result = @to.convert 'irc://irc.freenode.net/#ruby-lang'
|
|
|
|
|
|
|
|
assert_equal "\n<p><a href=\"irc://irc.freenode.net/#ruby-lang\">irc.freenode.net/#ruby-lang</a></p>\n", result
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_convert_RDOCLINK_label_label
|
|
|
|
result = @to.convert 'rdoc-label:label-One'
|
|
|
|
|
|
|
|
assert_equal "\n<p><a href=\"#label-One\">One</a></p>\n", result
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_convert_RDOCLINK_label_foottext
|
|
|
|
result = @to.convert 'rdoc-label:foottext-1'
|
|
|
|
|
2013-09-18 19:33:36 -04:00
|
|
|
assert_equal "\n<p><a href=\"#foottext-1\">1</a></p>\n", result
|
2012-11-26 23:28:14 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_convert_RDOCLINK_label_footmark
|
|
|
|
result = @to.convert 'rdoc-label:footmark-1'
|
|
|
|
|
2013-09-18 19:33:36 -04:00
|
|
|
assert_equal "\n<p><a href=\"#footmark-1\">1</a></p>\n", result
|
2012-11-26 23:28:14 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_convert_RDOCLINK_ref
|
|
|
|
result = @to.convert 'rdoc-ref:C'
|
|
|
|
|
|
|
|
assert_equal "\n<p>C</p>\n", result
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_convert_TIDYLINK_footnote
|
|
|
|
result = @to.convert 'text{*1}[rdoc-label:foottext-1:footmark-1]'
|
|
|
|
|
2013-09-18 19:33:36 -04:00
|
|
|
assert_equal "\n<p>text<sup><a id=\"footmark-1\" href=\"#foottext-1\">1</a></sup></p>\n", result
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_convert_TIDYLINK_multiple
|
|
|
|
result = @to.convert '{a}[http://example] {b}[http://example]'
|
|
|
|
|
|
|
|
expected = <<-EXPECTED
|
|
|
|
|
|
|
|
<p><a href=\"http://example\">a</a> <a href=\"http://example\">b</a></p>
|
|
|
|
EXPECTED
|
|
|
|
|
|
|
|
assert_equal expected, result
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_convert_TIDYLINK_image
|
|
|
|
result =
|
|
|
|
@to.convert '{rdoc-image:path/to/image.jpg}[http://example.com]'
|
|
|
|
|
|
|
|
expected =
|
|
|
|
"\n<p><a href=\"http://example.com\"><img src=\"path/to/image.jpg\"></a></p>\n"
|
|
|
|
|
|
|
|
assert_equal expected, result
|
2012-11-26 23:28:14 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_convert_TIDYLINK_rdoc_label
|
|
|
|
result = @to.convert '{foo}[rdoc-label:foottext-1]'
|
|
|
|
|
|
|
|
assert_equal "\n<p><a href=\"#foottext-1\">foo</a></p>\n", result
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_convert_TIDYLINK_irc
|
|
|
|
result = @to.convert '{ruby-lang}[irc://irc.freenode.net/#ruby-lang]'
|
|
|
|
|
|
|
|
assert_equal "\n<p><a href=\"irc://irc.freenode.net/#ruby-lang\">ruby-lang</a></p>\n", result
|
|
|
|
end
|
|
|
|
|
2021-03-14 05:26:19 -04:00
|
|
|
def test_convert_with_exclude_tag
|
|
|
|
assert_equal "\n<p><code>aaa</code>[:symbol]</p>\n", @to.convert('+aaa+[:symbol]')
|
|
|
|
assert_equal "\n<p><code>aaa[:symbol]</code></p>\n", @to.convert('+aaa[:symbol]+')
|
2022-04-11 15:37:29 -04:00
|
|
|
assert_equal "\n<p><code>https:</code>-foobar</p>\n", @to.convert('<tt>https:</tt>-foobar')
|
2021-03-14 05:26:19 -04:00
|
|
|
assert_equal "\n<p><a href=\":symbol\">aaa</a></p>\n", @to.convert('aaa[:symbol]')
|
|
|
|
end
|
|
|
|
|
2021-03-16 05:59:22 -04:00
|
|
|
def test_convert_underscore_adjacent_to_code
|
|
|
|
assert_equal "\n<p><code>aaa</code>_</p>\n", @to.convert(%q{+aaa+_})
|
2021-08-27 23:57:36 -04:00
|
|
|
assert_equal "\n<p>\u{2018}<code>i386-mswin32_</code><em>MSRTVERSION</em>\u{2019}</p>\n", @to.convert(%q{`+i386-mswin32_+_MSRTVERSION_'})
|
2021-03-16 05:59:22 -04:00
|
|
|
end
|
|
|
|
|
2010-12-28 17:08:56 -05:00
|
|
|
def test_gen_url
|
|
|
|
assert_equal '<a href="example">example</a>',
|
|
|
|
@to.gen_url('link:example', 'example')
|
|
|
|
end
|
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
def test_gen_url_rdoc_label
|
|
|
|
assert_equal '<a href="#foottext-1">example</a>',
|
|
|
|
@to.gen_url('rdoc-label:foottext-1', 'example')
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_gen_url_rdoc_label_id
|
2013-09-18 19:33:36 -04:00
|
|
|
assert_equal '<sup><a id="footmark-1" href="#foottext-1">example</a></sup>',
|
2012-11-26 23:28:14 -05:00
|
|
|
@to.gen_url('rdoc-label:foottext-1:footmark-1', 'example')
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_gen_url_image_url
|
2011-08-23 19:53:49 -04:00
|
|
|
assert_equal '<img src="http://example.com/image.png" />', @to.gen_url('http://example.com/image.png', 'ignored')
|
|
|
|
end
|
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
def test_gen_url_ssl_image_url
|
2011-08-23 19:53:49 -04:00
|
|
|
assert_equal '<img src="https://example.com/image.png" />', @to.gen_url('https://example.com/image.png', 'ignored')
|
|
|
|
end
|
|
|
|
|
2021-03-21 01:36:57 -04:00
|
|
|
def test_gen_url_rdoc_file
|
2021-06-30 16:39:13 -04:00
|
|
|
assert_equal '<a href="example_rdoc.html">example</a>',
|
|
|
|
@to.gen_url('example.rdoc', 'example')
|
2021-03-21 01:36:57 -04:00
|
|
|
assert_equal '<a href="doc/example_rdoc.html">example</a>',
|
|
|
|
@to.gen_url('doc/example.rdoc', 'example')
|
2021-05-14 12:06:36 -04:00
|
|
|
assert_equal '<a href="../ex.doc/example_rdoc.html">example</a>',
|
2021-03-21 01:36:57 -04:00
|
|
|
@to.gen_url('../ex.doc/example.rdoc', 'example')
|
2021-04-09 12:58:09 -04:00
|
|
|
assert_equal '<a href="doc/example_rdoc.html#label-one">example</a>',
|
|
|
|
@to.gen_url('doc/example.rdoc#label-one', 'example')
|
2021-05-14 12:06:36 -04:00
|
|
|
assert_equal '<a href="../ex.doc/example_rdoc.html#label-two">example</a>',
|
2021-04-09 12:58:09 -04:00
|
|
|
@to.gen_url('../ex.doc/example.rdoc#label-two', 'example')
|
2021-03-21 01:36:57 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_gen_url_md_file
|
2021-06-30 16:39:13 -04:00
|
|
|
assert_equal '<a href="example_md.html">example</a>',
|
|
|
|
@to.gen_url('example.md', 'example')
|
2021-03-21 01:36:57 -04:00
|
|
|
assert_equal '<a href="doc/example_md.html">example</a>',
|
|
|
|
@to.gen_url('doc/example.md', 'example')
|
2021-05-14 12:06:36 -04:00
|
|
|
assert_equal '<a href="../ex.doc/example_md.html">example</a>',
|
2021-03-21 01:36:57 -04:00
|
|
|
@to.gen_url('../ex.doc/example.md', 'example')
|
2021-04-09 12:58:09 -04:00
|
|
|
assert_equal '<a href="doc/example_md.html#label-one">example</a>',
|
|
|
|
@to.gen_url('doc/example.md#label-one', 'example')
|
2021-05-14 12:06:36 -04:00
|
|
|
assert_equal '<a href="../ex.doc/example_md.html#label-two">example</a>',
|
2021-04-09 12:58:09 -04:00
|
|
|
@to.gen_url('../ex.doc/example.md#label-two', 'example')
|
2021-03-21 01:36:57 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_gen_url_rb_file
|
2021-06-30 16:39:13 -04:00
|
|
|
assert_equal '<a href="example_rb.html">example</a>',
|
|
|
|
@to.gen_url('example.rb', 'example')
|
2021-03-21 01:36:57 -04:00
|
|
|
assert_equal '<a href="doc/example_rb.html">example</a>',
|
|
|
|
@to.gen_url('doc/example.rb', 'example')
|
2021-05-14 12:06:36 -04:00
|
|
|
assert_equal '<a href="../ex.doc/example_rb.html">example</a>',
|
2021-03-21 01:36:57 -04:00
|
|
|
@to.gen_url('../ex.doc/example.rb', 'example')
|
2021-04-09 12:58:09 -04:00
|
|
|
assert_equal '<a href="doc/example_rb.html#label-one">example</a>',
|
|
|
|
@to.gen_url('doc/example.rb#label-one', 'example')
|
2021-05-14 12:06:36 -04:00
|
|
|
assert_equal '<a href="../ex.doc/example_rb.html#label-two">example</a>',
|
2021-04-09 12:58:09 -04:00
|
|
|
@to.gen_url('../ex.doc/example.rb#label-two', 'example')
|
2021-03-21 01:36:57 -04:00
|
|
|
end
|
|
|
|
|
2018-10-17 02:28:20 -04:00
|
|
|
def test_handle_regexp_HYPERLINK_link
|
|
|
|
target = RDoc::Markup::RegexpHandling.new 0, 'link:README.txt'
|
2011-07-30 20:19:00 -04:00
|
|
|
|
2018-10-17 02:28:20 -04:00
|
|
|
link = @to.handle_regexp_HYPERLINK target
|
2011-07-30 20:19:00 -04:00
|
|
|
|
|
|
|
assert_equal '<a href="README.txt">README.txt</a>', link
|
|
|
|
end
|
|
|
|
|
2018-10-17 02:28:20 -04:00
|
|
|
def test_handle_regexp_HYPERLINK_irc
|
|
|
|
target = RDoc::Markup::RegexpHandling.new 0, 'irc://irc.freenode.net/#ruby-lang'
|
2012-11-26 23:28:14 -05:00
|
|
|
|
2018-10-17 02:28:20 -04:00
|
|
|
link = @to.handle_regexp_HYPERLINK target
|
2012-11-26 23:28:14 -05:00
|
|
|
|
|
|
|
assert_equal '<a href="irc://irc.freenode.net/#ruby-lang">irc.freenode.net/#ruby-lang</a>', link
|
|
|
|
end
|
|
|
|
|
2010-12-19 22:22:49 -05:00
|
|
|
def test_list_verbatim_2
|
|
|
|
str = "* one\n verb1\n verb2\n* two\n"
|
|
|
|
|
|
|
|
expected = <<-EXPECTED
|
|
|
|
<ul><li>
|
|
|
|
<p>one</p>
|
|
|
|
|
2014-12-06 20:22:37 -05:00
|
|
|
<pre class=\"ruby\"><span class=\"ruby-identifier\">verb1</span>
|
|
|
|
<span class=\"ruby-identifier\">verb2</span>
|
|
|
|
</pre>
|
2010-12-19 22:22:49 -05:00
|
|
|
</li><li>
|
|
|
|
<p>two</p>
|
|
|
|
</li></ul>
|
|
|
|
EXPECTED
|
|
|
|
|
|
|
|
assert_equal expected, @m.convert(str, @to)
|
2008-09-24 22:43:03 -04:00
|
|
|
end
|
|
|
|
|
2012-11-26 23:28:14 -05:00
|
|
|
def test_parseable_eh
|
2014-12-06 20:22:37 -05:00
|
|
|
valid_syntax = [
|
|
|
|
'def x() end',
|
|
|
|
'def x; end',
|
|
|
|
'class C; end',
|
|
|
|
"module M end",
|
|
|
|
'a # => blah',
|
|
|
|
'x { |y| nil }',
|
|
|
|
'x do |y| nil end',
|
|
|
|
'# only a comment',
|
|
|
|
'require "foo"',
|
|
|
|
'cls="foo"'
|
|
|
|
]
|
|
|
|
invalid_syntax = [
|
|
|
|
'def x end',
|
|
|
|
'class C < end',
|
|
|
|
'module M < C end',
|
|
|
|
'a=># blah',
|
|
|
|
'x { |y| ... }',
|
|
|
|
'x do |y| ... end',
|
|
|
|
'// only a comment',
|
|
|
|
'<% require "foo" %>',
|
|
|
|
'class="foo"'
|
|
|
|
]
|
|
|
|
valid_syntax.each do |t|
|
|
|
|
assert @to.parseable?(t), "valid syntax considered invalid: #{t}"
|
|
|
|
end
|
|
|
|
invalid_syntax.each do |t|
|
|
|
|
refute @to.parseable?(t), "invalid syntax considered valid: #{t}"
|
|
|
|
end
|
2012-11-26 23:28:14 -05:00
|
|
|
end
|
|
|
|
|
2010-12-19 22:22:49 -05:00
|
|
|
def test_to_html
|
2012-11-26 23:28:14 -05:00
|
|
|
assert_equal "\n<p><code>--</code></p>\n", util_format("<tt>--</tt>")
|
2008-07-17 20:46:16 -04:00
|
|
|
end
|
|
|
|
|
2010-12-19 22:22:49 -05:00
|
|
|
def util_format text
|
|
|
|
paragraph = RDoc::Markup::Paragraph.new text
|
2008-07-17 20:46:16 -04:00
|
|
|
|
2010-04-01 03:45:16 -04:00
|
|
|
@to.start_accepting
|
|
|
|
@to.accept_paragraph paragraph
|
|
|
|
@to.end_accepting
|
2008-07-17 20:46:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2008-10-24 19:05:28 -04:00
|
|
|
|