summaryrefslogtreecommitdiff
path: root/test/rdoc
diff options
context:
space:
mode:
authorMike Dalessio <mike.dalessio@gmail.com>2021-10-11 13:44:37 -0400
committergit <svn-admin@ruby-lang.org>2021-10-16 01:39:36 +0900
commit7aec65add42d20ba8d70ad33c7b1e8978007e29e (patch)
treeaf38792b70ba5e7f217c56cf10847b3005df0252 /test/rdoc
parentc322069a670a1ea2077429d9e7146e93e8e92eae (diff)
[ruby/rdoc] feat: add support for :category: on C functions
https://github.com/ruby/rdoc/commit/45c92005fe
Diffstat (limited to 'test/rdoc')
-rw-r--r--test/rdoc/test_rdoc_parser_c.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/rdoc/test_rdoc_parser_c.rb b/test/rdoc/test_rdoc_parser_c.rb
index 93d19dd26f..8f51f32f26 100644
--- a/test/rdoc/test_rdoc_parser_c.rb
+++ b/test/rdoc/test_rdoc_parser_c.rb
@@ -1600,6 +1600,39 @@ Init_IO(void) {
assert_equal "Method Comment! ", read_method.comment.text
assert_equal "rb_io_s_read", read_method.c_function
assert read_method.singleton
+ assert_nil read_method.section.title
+ end
+
+ def test_define_method_with_category
+ content = <<-EOF
+/* :category: Awesome Methods
+ Method Comment!
+ */
+static VALUE
+rb_io_s_read(argc, argv, io)
+ int argc;
+ VALUE *argv;
+ VALUE io;
+{
+}
+
+void
+Init_IO(void) {
+ /*
+ * a comment for class Foo on rb_define_class
+ */
+ VALUE rb_cIO = rb_define_class("IO", rb_cObject);
+ rb_define_singleton_method(rb_cIO, "read", rb_io_s_read, -1);
+}
+ EOF
+
+ klass = util_get_class content, 'rb_cIO'
+ read_method = klass.method_list.first
+ assert_equal "read", read_method.name
+ assert_equal "Method Comment!", read_method.comment.text.strip
+ assert_equal "rb_io_s_read", read_method.c_function
+ assert read_method.singleton
+ assert_equal "Awesome Methods", read_method.section.title
end
def test_define_method_dynamically