diff options
| author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-06-28 14:29:12 +0900 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2022-06-28 14:51:49 +0900 |
| commit | 51be2cf6d23466e173ad66eac9a4b3ae32097cc4 (patch) | |
| tree | d4be3f0ffc5f5b571f0c07cb1d017752b9eab8ac | |
| parent | aba804ef91a5b2aa88efdd74205026aca3f943b2 (diff) | |
[ruby/rdoc] Parse also InitVM-prefixed functions
Initialization depending on VM is separated.
https://github.com/ruby/rdoc/commit/030d10fccd
| -rw-r--r-- | lib/rdoc/parser/c.rb | 2 | ||||
| -rw-r--r-- | test/rdoc/test_rdoc_parser_c.rb | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb index 52317c5ad8..83a216a8ac 100644 --- a/lib/rdoc/parser/c.rb +++ b/lib/rdoc/parser/c.rb @@ -720,7 +720,7 @@ class RDoc::Parser::C < RDoc::Parser ((?>/\*.*?\*/\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 diff --git a/test/rdoc/test_rdoc_parser_c.rb b/test/rdoc/test_rdoc_parser_c.rb index c7312bebba..b7e1648cd6 100644 --- a/test/rdoc/test_rdoc_parser_c.rb +++ b/test/rdoc/test_rdoc_parser_c.rb @@ -857,6 +857,23 @@ Init_Foo(void) { 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 /* |
