aboutsummaryrefslogtreecommitdiffstats
path: root/test/rdoc
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2021-03-14 18:26:19 +0900
committeraycabta <aycabta@gmail.com>2021-04-03 01:21:12 +0900
commit54aa11efa8b1be2c5d20402890d6d2fa90aa19a8 (patch)
tree8eb3e980e5ea244560337bec32ca1f8c87fdc7f6 /test/rdoc
parentab89c45b906380353d1b399781170cafe1d7b503 (diff)
downloadruby-54aa11efa8b1be2c5d20402890d6d2fa90aa19a8.tar.gz
[ruby/rdoc] Disable other notations in <code> tags
https://github.com/ruby/rdoc/commit/0cd3b55210
Diffstat (limited to 'test/rdoc')
-rw-r--r--test/rdoc/test_rdoc_markup_attribute_manager.rb24
-rw-r--r--test/rdoc/test_rdoc_markup_to_html.rb6
2 files changed, 27 insertions, 3 deletions
diff --git a/test/rdoc/test_rdoc_markup_attribute_manager.rb b/test/rdoc/test_rdoc_markup_attribute_manager.rb
index a180666867..2ec135dca7 100644
--- a/test/rdoc/test_rdoc_markup_attribute_manager.rb
+++ b/test/rdoc/test_rdoc_markup_attribute_manager.rb
@@ -172,22 +172,25 @@ class TestRDocMarkupAttributeManager < RDoc::TestCase
def test_convert_attrs
str = '+foo+'.dup
- attrs = RDoc::Markup::AttrSpan.new str.length
+ attrs = RDoc::Markup::AttrSpan.new str.length, @am.exclusive_bitmap
+ @am.convert_attrs str, attrs, true
@am.convert_attrs str, attrs
assert_equal "\000foo\000", str
str = '+:foo:+'.dup
- attrs = RDoc::Markup::AttrSpan.new str.length
+ attrs = RDoc::Markup::AttrSpan.new str.length, @am.exclusive_bitmap
+ @am.convert_attrs str, attrs, true
@am.convert_attrs str, attrs
assert_equal "\000:foo:\000", str
str = '+x-y+'.dup
- attrs = RDoc::Markup::AttrSpan.new str.length
+ attrs = RDoc::Markup::AttrSpan.new str.length, @am.exclusive_bitmap
+ @am.convert_attrs str, attrs, true
@am.convert_attrs str, attrs
assert_equal "\000x-y\000", str
@@ -243,6 +246,21 @@ class TestRDocMarkupAttributeManager < RDoc::TestCase
output('unhandled <p>tag</p> unchanged')
end
+ def test_exclude_tag
+ assert_equal '<CODE>aaa</CODE>[:symbol]', output('+aaa+[:symbol]')
+ assert_equal '<CODE>aaa[:symbol]</CODE>', output('+aaa[:symbol]+')
+ assert_equal 'aaa[:symbol]', output('aaa[:symbol]')
+ end
+
+ def test_exclude_tag_flow
+ assert_equal [@tt_on, "aaa", @tt_off, "[:symbol]"],
+ @am.flow("+aaa+[:symbol]")
+ assert_equal [@tt_on, "aaa[:symbol]", @tt_off],
+ @am.flow("+aaa[:symbol]+")
+ assert_equal ["aaa[:symbol]"],
+ @am.flow("aaa[:symbol]")
+ end
+
def test_html_like_em_bold
assert_equal ["cat ", @em_on, "and ", @em_to_bold, "dog", @bold_off],
@am.flow("cat <i>and </i><b>dog</b>")
diff --git a/test/rdoc/test_rdoc_markup_to_html.rb b/test/rdoc/test_rdoc_markup_to_html.rb
index fb94269064..6ec52989c7 100644
--- a/test/rdoc/test_rdoc_markup_to_html.rb
+++ b/test/rdoc/test_rdoc_markup_to_html.rb
@@ -704,6 +704,12 @@ EXPECTED
assert_equal "\n<p><a href=\"irc://irc.freenode.net/#ruby-lang\">ruby-lang</a></p>\n", result
end
+ 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]+')
+ assert_equal "\n<p><a href=\":symbol\">aaa</a></p>\n", @to.convert('aaa[:symbol]')
+ end
+
def test_gen_url
assert_equal '<a href="example">example</a>',
@to.gen_url('link:example', 'example')