mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/rdoc: Update to RDoc 4.2.0.
* test/rdoc: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7d2d6d0a2f
commit
4260aa1dc3
28 changed files with 622 additions and 177 deletions
|
@ -24,7 +24,7 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
|
|||
|
||||
def accept_heading
|
||||
links = '<span><a href="#label-Hello">¶</a> ' +
|
||||
'<a href="#documentation">↑</a></span>'
|
||||
'<a href="#top">↑</a></span>'
|
||||
expected = "\n<h5 id=\"label-Hello\">Hello#{links}</h5>\n"
|
||||
|
||||
assert_equal expected, @to.res.join
|
||||
|
@ -32,35 +32,35 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
|
|||
|
||||
def accept_heading_1
|
||||
links = '<span><a href="#label-Hello">¶</a> ' +
|
||||
'<a href="#documentation">↑</a></span>'
|
||||
'<a href="#top">↑</a></span>'
|
||||
|
||||
assert_equal "\n<h1 id=\"label-Hello\">Hello#{links}</h1>\n", @to.res.join
|
||||
end
|
||||
|
||||
def accept_heading_2
|
||||
links = '<span><a href="#label-Hello">¶</a> ' +
|
||||
'<a href="#documentation">↑</a></span>'
|
||||
'<a href="#top">↑</a></span>'
|
||||
|
||||
assert_equal "\n<h2 id=\"label-Hello\">Hello#{links}</h2>\n", @to.res.join
|
||||
end
|
||||
|
||||
def accept_heading_3
|
||||
links = '<span><a href="#label-Hello">¶</a> ' +
|
||||
'<a href="#documentation">↑</a></span>'
|
||||
'<a href="#top">↑</a></span>'
|
||||
|
||||
assert_equal "\n<h3 id=\"label-Hello\">Hello#{links}</h3>\n", @to.res.join
|
||||
end
|
||||
|
||||
def accept_heading_4
|
||||
links = '<span><a href="#label-Hello">¶</a> ' +
|
||||
'<a href="#documentation">↑</a></span>'
|
||||
'<a href="#top">↑</a></span>'
|
||||
|
||||
assert_equal "\n<h4 id=\"label-Hello\">Hello#{links}</h4>\n", @to.res.join
|
||||
end
|
||||
|
||||
def accept_heading_b
|
||||
links = '<span><a href="#label-Hello">¶</a> ' +
|
||||
'<a href="#documentation">↑</a></span>'
|
||||
'<a href="#top">↑</a></span>'
|
||||
inner = "<strong>Hello</strong>"
|
||||
|
||||
assert_equal "\n<h1 id=\"label-Hello\">#{inner}#{links}</h1>\n",
|
||||
|
@ -69,7 +69,7 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
|
|||
|
||||
def accept_heading_suppressed_crossref
|
||||
links = '<span><a href="#label-Hello">¶</a> ' +
|
||||
'<a href="#documentation">↑</a></span>'
|
||||
'<a href="#top">↑</a></span>'
|
||||
|
||||
assert_equal "\n<h1 id=\"label-Hello\">Hello#{links}</h1>\n", @to.res.join
|
||||
end
|
||||
|
@ -292,7 +292,7 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
|
|||
end
|
||||
|
||||
def accept_verbatim
|
||||
assert_equal "\n<pre>hi\n world</pre>\n", @to.res.join
|
||||
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
|
||||
end
|
||||
|
||||
def end_accepting
|
||||
|
@ -348,7 +348,7 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
|
|||
@to.accept_heading @RM::Heading.new(7, 'Hello')
|
||||
|
||||
links = '<span><a href="#label-Hello">¶</a> ' +
|
||||
'<a href="#documentation">↑</a></span>'
|
||||
'<a href="#top">↑</a></span>'
|
||||
|
||||
assert_equal "\n<h6 id=\"label-Hello\">Hello#{links}</h6>\n", @to.res.join
|
||||
end
|
||||
|
@ -360,7 +360,7 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
|
|||
@to.accept_heading head(1, 'Hello')
|
||||
|
||||
links = '<span><a href="#class-Foo-label-Hello">¶</a> ' +
|
||||
'<a href="#documentation">↑</a></span>'
|
||||
'<a href="#top">↑</a></span>'
|
||||
|
||||
assert_equal "\n<h1 id=\"class-Foo-label-Hello\">Hello#{links}</h1>\n",
|
||||
@to.res.join
|
||||
|
@ -373,7 +373,7 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
|
|||
@to.accept_heading @RM::Heading.new(1, 'Hello')
|
||||
|
||||
links = '<span><a href="#method-i-foo-label-Hello">¶</a> ' +
|
||||
'<a href="#documentation">↑</a></span>'
|
||||
'<a href="#top">↑</a></span>'
|
||||
|
||||
assert_equal "\n<h1 id=\"method-i-foo-label-Hello\">Hello#{links}</h1>\n",
|
||||
@to.res.join
|
||||
|
@ -404,7 +404,7 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
|
|||
|
||||
@to.accept_heading @RM::Heading.new(1, 'Hello')
|
||||
|
||||
assert_equal "\n<h1>Hello<span><a href=\"#label-Hello\">¶</a> <a href=\"#documentation\">↑</a></span></h1>\n", @to.res.join
|
||||
assert_equal "\n<h1>Hello<span><a href=\"#label-Hello\">¶</a> <a href=\"#top\">↑</a></span></h1>\n", @to.res.join
|
||||
end
|
||||
|
||||
def test_accept_heading_output_decoration_with_pipe
|
||||
|
@ -444,8 +444,7 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
|
|||
|
||||
expected = <<-EXPECTED
|
||||
|
||||
<pre>#{inner}
|
||||
</pre>
|
||||
<pre>#{inner}</pre>
|
||||
EXPECTED
|
||||
|
||||
assert_equal expected, @to.res.join
|
||||
|
@ -604,8 +603,9 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
|
|||
<ul><li>
|
||||
<p>one</p>
|
||||
|
||||
<pre>verb1
|
||||
verb2</pre>
|
||||
<pre class=\"ruby\"><span class=\"ruby-identifier\">verb1</span>
|
||||
<span class=\"ruby-identifier\">verb2</span>
|
||||
</pre>
|
||||
</li><li>
|
||||
<p>two</p>
|
||||
</li></ul>
|
||||
|
@ -615,16 +615,36 @@ verb2</pre>
|
|||
end
|
||||
|
||||
def test_parseable_eh
|
||||
assert @to.parseable?('def x() end'), 'def'
|
||||
assert @to.parseable?('class C end'), 'class'
|
||||
assert @to.parseable?('module M end'), 'module'
|
||||
assert @to.parseable?('a # => blah'), '=>'
|
||||
assert @to.parseable?('x { |y| ... }'), '{ |x|'
|
||||
assert @to.parseable?('x do |y| ... end'), 'do |x|'
|
||||
refute @to.parseable?('* 1'), '* 1'
|
||||
refute @to.parseable?('# only a comment'), '# only a comment'
|
||||
refute @to.parseable?('<% require "foo" %>'), 'ERB'
|
||||
refute @to.parseable?('class="foo"'), 'HTML class'
|
||||
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',
|
||||
'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
|
||||
end
|
||||
|
||||
def test_to_html
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue