summaryrefslogtreecommitdiff
path: root/test/rdoc
diff options
context:
space:
mode:
authorMike Dalessio <mike.dalessio@gmail.com>2021-10-11 17:01:52 -0400
committergit <svn-admin@ruby-lang.org>2021-10-16 01:39:06 +0900
commitfbd0516afc2bb7219716aa4f810f83af8112ca49 (patch)
tree23717fa42b0ed163f0cb90a7ab420858bbaed92c /test/rdoc
parentd4894e81c0a2acb826686f178e4b1b1ed88adefa (diff)
[ruby/rdoc] fix: comments in C files use the global markup option
Previously, Parser::C comments all defaulted to "rdoc" format, even when the user had set a different default with the `--markup=<choice>` option. https://github.com/ruby/rdoc/commit/4643b08a26
Diffstat (limited to 'test/rdoc')
-rw-r--r--test/rdoc/test_rdoc_parser_c.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/rdoc/test_rdoc_parser_c.rb b/test/rdoc/test_rdoc_parser_c.rb
index 41001be22c..93d19dd26f 100644
--- a/test/rdoc/test_rdoc_parser_c.rb
+++ b/test/rdoc/test_rdoc_parser_c.rb
@@ -1946,6 +1946,23 @@ void Init_Blah(void) {
assert_equal("rdoc", klass.attributes.find {|a| a.name == "default_format"}.comment.format)
end
+ def test_markup_format_override
+ content = <<-EOF
+void Init_Blah(void) {
+ cBlah = rb_define_class("Blah", rb_cObject);
+
+ /*
+ * This should be interpreted in the default format.
+ */
+ rb_attr(cBlah, rb_intern("default_format"), 1, 1, Qfalse);
+}
+ EOF
+
+ @options.markup = "markdown"
+ klass = util_get_class content, 'cBlah'
+ assert_equal("markdown", klass.attributes.find {|a| a.name == "default_format"}.comment.format)
+ end
+
def util_get_class content, name = nil
@parser = util_parser content
@parser.scan