diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-06-28 19:40:27 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2022-06-28 20:17:30 +0900 |
commit | 131422ceea4e1970e68907c337976b898a797d8a (patch) | |
tree | f75249afc31349ad44a1dabfbbe2d76a9c8e9bf9 /test/rdoc | |
parent | 98bf8c83fa4d5d36544a3d7a335a759de6529ab6 (diff) | |
download | ruby-131422ceea4e1970e68907c337976b898a797d8a.tar.gz |
[ruby/rdoc] Support attributes defined by `rb_struct_define`
https://github.com/ruby/rdoc/commit/854b370763
Diffstat (limited to 'test/rdoc')
-rw-r--r-- | test/rdoc/test_rdoc_parser_c.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/rdoc/test_rdoc_parser_c.rb b/test/rdoc/test_rdoc_parser_c.rb index b7e1648cd6..7cd04b52ef 100644 --- a/test/rdoc/test_rdoc_parser_c.rb +++ b/test/rdoc/test_rdoc_parser_c.rb @@ -311,6 +311,12 @@ VALUE cFoo = rb_struct_define( klass = util_get_class content, 'cFoo' assert_equal "this is the Foo class", klass.comment.text + + attributes = klass.attributes + assert_equal 3, attributes.size, -> {attributes} + ["some", "various", "fields"].zip(attributes) do |name, attr| + assert_equal RDoc::Attr.new("", name, "RW", ""), attr + end end def test_do_classes_struct_under @@ -326,6 +332,12 @@ VALUE cFoo = rb_struct_define_under( 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 + + attributes = klass.attributes + assert_equal 3, attributes.size, -> {attributes} + ["some", "various", "fields"].zip(attributes) do |name, attr| + assert_equal RDoc::Attr.new("", name, "RW", ""), attr + end end def test_do_classes_struct_without_accessor @@ -340,6 +352,7 @@ VALUE cFoo = rb_struct_define_without_accessor( klass = util_get_class content, 'cFoo' assert_equal "this is the Foo class", klass.comment.text + assert_empty klass.attributes end def test_do_classes_struct_without_accessor_under @@ -355,6 +368,7 @@ VALUE cFoo = rb_struct_define_without_accessor_under( 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 + assert_empty klass.attributes end def test_do_classes_class_under |