Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse also InitVM-prefixed functions #891

Merged
merged 1 commit into from
Jun 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rdoc/parser/c.rb
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ def find_class_comment class_name, class_mod
((?>/\*.*?\*/\s+))
(static\s+)?
void\s+
Init_#{class_name}\s*(?:_\(\s*)?\(\s*(?:void\s*)?\)%xmi then
Init(?:VM)?_(?i:#{class_name})\s*(?:_\(\s*)?\(\s*(?:void\s*)?\)%xm then
comment = $1.sub(%r%Document-(?:class|module):\s+#{class_name}%, '')
elsif @content =~ %r%Document-(?:class|module):\s+#{class_name}\s*?
(?:<\s+[:,\w]+)?\n((?>.*?\*/))%xm then
Expand Down
17 changes: 17 additions & 0 deletions test/rdoc/test_rdoc_parser_c.rb
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,23 @@ def test_find_class_comment_init
assert_equal "a comment for class Foo", klass.comment.text
end


def test_find_class_comment_initvm
content = <<-EOF
/*
* a comment for class Foo
*/
void
InitVM_Foo(void) {
VALUE foo = rb_define_class("Foo", rb_cObject);
}
EOF

klass = util_get_class content, 'foo'

assert_equal "a comment for class Foo", klass.comment.text
end

def test_find_class_comment_define_class
content = <<-EOF
/*
Expand Down