summaryrefslogtreecommitdiff
path: root/test/rdoc
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-02-08 17:19:15 +0900
committergit <svn-admin@ruby-lang.org>2022-02-09 18:43:07 +0900
commitdec96dd89744695d310b70a672b9ea044eeed89f (patch)
treebf9eb012f7ba515fefab3199070a4f719ac4fc22 /test/rdoc
parent7604933e03edf99800a082ce01dcaa5608462cd1 (diff)
[ruby/rdoc] Support all struct definition functions
Currently only `rb_struct_define_without_accessor` is supported by https://github.com/ruby/rdoc/pull/73. We should support other three functions too. https://github.com/ruby/rdoc/commit/d42288f06c
Diffstat (limited to 'test/rdoc')
-rw-r--r--test/rdoc/test_rdoc_parser_c.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/rdoc/test_rdoc_parser_c.rb b/test/rdoc/test_rdoc_parser_c.rb
index 8f51f32f26..3383cb6826 100644
--- a/test/rdoc/test_rdoc_parser_c.rb
+++ b/test/rdoc/test_rdoc_parser_c.rb
@@ -355,6 +355,35 @@ VALUE cFoo = rb_define_class("Foo", rb_cObject);
/* Document-class: Foo
* this is the Foo class
*/
+VALUE cFoo = rb_struct_define(
+ "Foo",
+ "some", "various", "fields", NULL);
+ EOF
+
+ klass = util_get_class content, 'cFoo'
+ assert_equal "this is the Foo class", klass.comment.text
+ end
+
+ def test_do_classes_struct_under
+ content = <<-EOF
+/* Document-class: Kernel::Foo
+ * this is the Foo class under Kernel
+ */
+VALUE cFoo = rb_struct_define_under(
+ rb_mKernel, "Foo",
+ "some", "various", "fields", NULL);
+ EOF
+
+ klass = util_get_class content, 'cFoo'
+ assert_equal 'Kernel::Foo', klass.full_name
+ assert_equal "this is the Foo class under Kernel", klass.comment.text
+ end
+
+ def test_do_classes_struct_without_accessor
+ content = <<-EOF
+/* Document-class: Foo
+ * this is the Foo class
+ */
VALUE cFoo = rb_struct_define_without_accessor(
"Foo", rb_cObject, foo_alloc,
"some", "various", "fields", NULL);
@@ -364,6 +393,21 @@ VALUE cFoo = rb_struct_define_without_accessor(
assert_equal "this is the Foo class", klass.comment.text
end
+ def test_do_classes_struct_without_accessor_under
+ content = <<-EOF
+/* Document-class: Kernel::Foo
+ * this is the Foo class under Kernel
+ */
+VALUE cFoo = rb_struct_define_without_accessor_under(
+ rb_mKernel, "Foo", rb_cObject, foo_alloc,
+ "some", "various", "fields", NULL);
+ EOF
+
+ klass = util_get_class content, 'cFoo'
+ assert_equal 'Kernel::Foo', klass.full_name
+ assert_equal "this is the Foo class under Kernel", klass.comment.text
+ end
+
def test_do_classes_class_under
content = <<-EOF
/* Document-class: Kernel::Foo