summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/rdoc/test_rdoc_markup_to_html_crossref.rb21
-rw-r--r--test/rdoc/test_rdoc_options.rb43
2 files changed, 42 insertions, 22 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
diff --git a/test/rdoc/test_rdoc_options.rb b/test/rdoc/test_rdoc_options.rb
index 1fc56b2d5e..eb8477483c 100644
--- a/test/rdoc/test_rdoc_options.rb
+++ b/test/rdoc/test_rdoc_options.rb
@@ -63,27 +63,28 @@ class TestRDocOptions < RDoc::TestCase
encoding = 'UTF-8'
expected = {
- 'charset' => 'UTF-8',
- 'encoding' => encoding,
- 'embed_mixins' => false,
- 'exclude' => %w[~\z \.orig\z \.rej\z \.bak\z \.gemspec\z],
- 'hyperlink_all' => false,
- 'line_numbers' => false,
- 'locale_dir' => 'locale',
- 'locale_name' => nil,
- 'main_page' => nil,
- 'markup' => 'rdoc',
- 'output_decoration' => true,
- 'page_dir' => nil,
- 'rdoc_include' => [],
- 'show_hash' => false,
- 'static_path' => [],
- 'tab_width' => 8,
- 'template_stylesheets' => [],
- 'title' => nil,
- 'visibility' => :protected,
- 'webcvs' => nil,
- 'skip_tests' => true,
+ 'charset' => 'UTF-8',
+ 'encoding' => encoding,
+ 'embed_mixins' => false,
+ 'exclude' => %w[~\z \.orig\z \.rej\z \.bak\z \.gemspec\z],
+ 'hyperlink_all' => false,
+ 'line_numbers' => false,
+ 'locale_dir' => 'locale',
+ 'locale_name' => nil,
+ 'main_page' => nil,
+ 'markup' => 'rdoc',
+ 'output_decoration' => true,
+ 'page_dir' => nil,
+ 'rdoc_include' => [],
+ 'show_hash' => false,
+ 'static_path' => [],
+ 'tab_width' => 8,
+ 'template_stylesheets' => [],
+ 'title' => nil,
+ 'visibility' => :protected,
+ 'warn_missing_rdoc_ref' => false,
+ 'webcvs' => nil,
+ 'skip_tests' => true,
}
assert_equal expected, coder