summaryrefslogtreecommitdiff
path: root/test/rdoc/test_rdoc_options.rb
diff options
context:
space:
mode:
authorMike Dalessio <[email protected]>2024-10-17 16:40:30 -0400
committergit <[email protected]>2024-10-17 20:40:34 +0000
commit0b38e184881839d347a777e82ad1b037a1aeca6e (patch)
tree8b71f0e8b97983d5b97c5772032adfd1c05250b6 /test/rdoc/test_rdoc_options.rb
parent48899d56a9c61d4a3e5fe822ed7c16a1f2868bd4 (diff)
[ruby/rdoc] feature: Render mixed-in methods and constants with
`--embed-mixins` (https://github.com/ruby/rdoc/pull/842) * Embed mixed-in methods and constants with `--embed-mixins` When `--embed-mixins` option is set: - methods from an `extend`ed module are documented as singleton methods - attrs from an `extend`ed module are documented as class attributes - methods from an `include`ed module are documented as instance methods - attrs from an `include`ed module are documented as instance attributes - constants from an `include`ed module are documented Sections are created when needed, and Darkfish's template annotates each of these mixed-in CodeObjects. We also respect the mixin methods' visibility. This feature is inspired by Yard's option of the same name. * Add comment to document why we set object visibility Co-authored-by: Stan Lo <[email protected]> * Add the mixin_from attribute to CodeObject's initializer * Add test coverage for private mixed-in attributes. --------- https://github.com/ruby/rdoc/commit/481c2ce660 Co-authored-by: Stan Lo <[email protected]>
Diffstat (limited to 'test/rdoc/test_rdoc_options.rb')
-rw-r--r--test/rdoc/test_rdoc_options.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/rdoc/test_rdoc_options.rb b/test/rdoc/test_rdoc_options.rb
index 5e8b1ae3d8..1fc56b2d5e 100644
--- a/test/rdoc/test_rdoc_options.rb
+++ b/test/rdoc/test_rdoc_options.rb
@@ -65,6 +65,7 @@ class TestRDocOptions < RDoc::TestCase
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,
@@ -589,6 +590,20 @@ rdoc_include:
assert_includes @options.rdoc_include, @options.root.to_s
end
+ def test_parse_embed_mixins
+ assert_false(@options.embed_mixins)
+
+ out, err = capture_output { @options.parse(["--embed-mixins"]) }
+ assert_empty(out)
+ assert_empty(err)
+ assert_true(@options.embed_mixins)
+
+ out, err = capture_output { @options.parse(["--no-embed-mixins"]) }
+ assert_empty(out)
+ assert_empty(err)
+ assert_false(@options.embed_mixins)
+ end
+
def test_parse_tab_width
@options.parse %w[--tab-width=1]
assert_equal 1, @options.tab_width