summaryrefslogtreecommitdiff
path: root/test/rdoc/test_rdoc_markup_to_html_crossref.rb
diff options
context:
space:
mode:
authorStan Lo <[email protected]>2024-12-17 03:34:56 +0800
committergit <[email protected]>2024-12-16 19:35:00 +0000
commita6fd6cb72f22531cc3cc976de99c5f9eccbf7101 (patch)
tree70c7090d4e5fca60926509e4c62f2755a246bc22 /test/rdoc/test_rdoc_markup_to_html_crossref.rb
parent80b8feb929be08bd718518a57d2b549c8dab80b3 (diff)
[ruby/rdoc] Print warnings for rdoc-ref links that can't be resolved
(https://github.com/ruby/rdoc/pull/1241) https://github.com/ruby/rdoc/commit/4a5206ae56
Diffstat (limited to 'test/rdoc/test_rdoc_markup_to_html_crossref.rb')
-rw-r--r--test/rdoc/test_rdoc_markup_to_html_crossref.rb21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/rdoc/test_rdoc_markup_to_html_crossref.rb b/test/rdoc/test_rdoc_markup_to_html_crossref.rb
index dc4488195a..d5817560e2 100644
--- a/test/rdoc/test_rdoc_markup_to_html_crossref.rb
+++ b/test/rdoc/test_rdoc_markup_to_html_crossref.rb
@@ -1,12 +1,13 @@
# frozen_string_literal: true
require_relative 'xref_test_case'
-class TestRDocMarkupToHtmlCrossref < XrefTestCase
+class RDocMarkupToHtmlCrossrefTest < XrefTestCase
def setup
super
@options.hyperlink_all = true
+ @options.warn_missing_rdoc_ref = true
@to = RDoc::Markup::ToHtmlCrossref.new @options, 'index.html', @c1
end
@@ -67,6 +68,16 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
assert_equal para("<a href=\"C1.html\"><code>C1</code></a>"), result
end
+ def test_convert_RDOCLINK_rdoc_ref_not_found
+ result = nil
+ stdout, _ = capture_output do
+ result = @to.convert 'rdoc-ref:FOO'
+ end
+
+ assert_equal para("FOO"), result
+ assert_include stdout, "index.html: `rdoc-ref:FOO` can't be resolved for `FOO`"
+ end
+
def test_convert_RDOCLINK_rdoc_ref_method
result = @to.convert 'rdoc-ref:C1#m'
@@ -153,6 +164,14 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
@to.gen_url('http://example', 'HTTP example')
end
+ def test_gen_url_rdoc_ref_not_found
+ stdout, _ = capture_output do
+ @to.gen_url 'rdoc-ref:FOO', 'FOO'
+ end
+
+ assert_include stdout, "index.html: `rdoc-ref:FOO` can't be resolved for `FOO`"
+ end
+
def test_handle_regexp_CROSSREF
assert_equal "<a href=\"C2/C3.html\"><code>C2::C3</code></a>", REGEXP_HANDLING('C2::C3')
end