summaryrefslogtreecommitdiff
path: root/test/rdoc
diff options
context:
space:
mode:
authorNate Matykiewicz <natematykiewicz@gmail.com>2020-04-04 23:20:22 -0500
committeraycabta <aycabta@gmail.com>2020-05-24 23:47:24 +0900
commitc79f9ea606d072176533b22813653f9fd26940af (patch)
tree735a290506b78b86b515defe36db079dd0fa5be3 /test/rdoc
parentb10c9d201222b144df7d63660d1c731af53c4ae2 (diff)
[ruby/rdoc] Escape method names in HTML
The following is invalid HTML: <a href="Array.html#method-i-3C-3C"><code><<</code></a></p> Incorrect: <code><<</code> Correct: <code>&lt;&lt;</code> Fixes #761 https://github.com/ruby/rdoc/commit/b120d087f6
Diffstat (limited to 'test/rdoc')
-rw-r--r--test/rdoc/test_rdoc_markup_to_html_crossref.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/rdoc/test_rdoc_markup_to_html_crossref.rb b/test/rdoc/test_rdoc_markup_to_html_crossref.rb
index bac2569f87..70306c683d 100644
--- a/test/rdoc/test_rdoc_markup_to_html_crossref.rb
+++ b/test/rdoc/test_rdoc_markup_to_html_crossref.rb
@@ -89,6 +89,20 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
assert_equal para("<a href=\"C1.html#method-c-25\"><code>C1::%</code></a>"), result
end
+ def test_convert_RDOCLINK_rdoc_ref_method_escape_html
+ m = @c1.add_method RDoc::AnyMethod.new nil, '<<'
+ m.singleton = false
+
+ result = @to.convert 'rdoc-ref:C1#<<'
+
+ assert_equal para("<a href=\"C1.html#method-i-3C-3C\"><code>C1#&lt;&lt;</code></a>"), result
+ m.singleton = true
+
+ result = @to.convert 'rdoc-ref:C1::<<'
+
+ assert_equal para("<a href=\"C1.html#method-c-3C-3C\"><code>C1::&lt;&lt;</code></a>"), result
+ end
+
def test_convert_RDOCLINK_rdoc_ref_method_percent_label
m = @c1.add_method RDoc::AnyMethod.new nil, '%'
m.singleton = false