diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-16 23:07:49 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-16 23:07:49 +0000 |
commit | 810008293fd8ce3a9d3d62dcf2f2229b98c2bd49 (patch) | |
tree | 7e06c2b0a08a3b29bf6a1c1cfd44a352fb2d82e2 /test/rdoc/test_rdoc_markup_formatter.rb | |
parent | 10295ab2ff87b1189dcbe129a07a692417db53f6 (diff) |
* lib/rdoc.rb: Updated VERSION.
* lib/rdoc/markup/attribute_manager.rb: Removed useless empty check.
* lib/rdoc/markup/to_markdown.rb: Support links from other formats.
* lib/rdoc/markup/formatter.rb: ditto.
* lib/rdoc/markup/to_html.rb: ditto.
* test/rdoc/test_rdoc_markup_formatter.rb: Test for above.
* test/rdoc/test_rdoc_markup_to_html.rb: ditto.
* test/rdoc/test_rdoc_markup_to_markdown.rb: ditto.
* lib/rdoc/rd/block_parser.rb: Improved footnote display. Worked
around bug in footnote conversion to Markdown.
* test/rdoc/test_rdoc_rd_block_parser.rb: Test for above.
* lib/rdoc/rd/inline_parser.rb: Fixed bug with emphasis inside
verbatim.
* test/rdoc/test_rdoc_rd_inline_parser.rb: Test for above.
* test/rdoc/test_rdoc_parser_rd.rb: Use mu_pp, use shortcut methods.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rdoc/test_rdoc_markup_formatter.rb')
-rw-r--r-- | test/rdoc/test_rdoc_markup_formatter.rb | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/test/rdoc/test_rdoc_markup_formatter.rb b/test/rdoc/test_rdoc_markup_formatter.rb index 9512babce3..c0dde757cb 100644 --- a/test/rdoc/test_rdoc_markup_formatter.rb +++ b/test/rdoc/test_rdoc_markup_formatter.rb @@ -48,6 +48,97 @@ class TestRDocMarkupFormatter < RDoc::TestCase @tt = @attributes.bitmap_for :TT end + def test_class_gen_relative_url + def gen(from, to) + RDoc::Markup::ToHtml.gen_relative_url from, to + end + + assert_equal 'a.html', gen('a.html', 'a.html') + assert_equal 'b.html', gen('a.html', 'b.html') + + assert_equal 'd.html', gen('a/c.html', 'a/d.html') + assert_equal '../a.html', gen('a/c.html', 'a.html') + assert_equal 'a/c.html', gen('a.html', 'a/c.html') + end + + def special_names + @attribute_manager.special.map do |_, mask| + @attributes.as_string mask + end + end + + def test_add_special_RDOCLINK + @to.add_special_RDOCLINK + + assert_includes special_names, 'RDOCLINK' + end + + def test_add_special_TIDYLINK + @to.add_special_TIDYLINK + + assert_includes special_names, 'TIDYLINK' + end + + def test_parse_url + scheme, url, id = @to.parse_url 'example/foo' + + assert_equal 'http', scheme + assert_equal 'http://example/foo', url + assert_equal nil, id + end + + def test_parse_url_anchor + scheme, url, id = @to.parse_url '#foottext-1' + + assert_equal nil, scheme + assert_equal '#foottext-1', url + assert_equal nil, id + end + + def test_parse_url_link + scheme, url, id = @to.parse_url 'link:README.txt' + + assert_equal 'link', scheme + assert_equal 'README.txt', url + assert_equal nil, id + end + + def test_parse_url_link_id + scheme, url, id = @to.parse_url 'link:README.txt#label-foo' + + assert_equal 'link', scheme + assert_equal 'README.txt#label-foo', url + assert_equal nil, id + end + + def test_parse_url_rdoc_label + scheme, url, id = @to.parse_url 'rdoc-label:foo' + + assert_equal 'link', scheme + assert_equal '#foo', url + assert_equal nil, id + + scheme, url, id = @to.parse_url 'rdoc-label:foo:bar' + + assert_equal 'link', scheme + assert_equal '#foo', url + assert_equal ' id="bar"', id + end + + def test_parse_url_scheme + scheme, url, id = @to.parse_url 'http://example/foo' + + assert_equal 'http', scheme + assert_equal 'http://example/foo', url + assert_equal nil, id + + scheme, url, id = @to.parse_url 'https://example/foo' + + assert_equal 'https', scheme + assert_equal 'https://example/foo', url + assert_equal nil, id + end + def test_convert_tt_special converted = @to.convert '<code>AAA</code>' |