diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-09-05 01:41:25 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-09-05 01:41:25 +0000 |
commit | d42d6e690e3f553b971322eae783ac6b0d4d9692 (patch) | |
tree | 2004bf4517ee7b81466c300cf30092e62e65467e /test/rdoc/test_rdoc_parser_c.rb | |
parent | 670c6e8ce9d4a12bb4832e10fab27365398649bf (diff) |
* lib/rdoc.rb, lib/rdoc, test/rdoc: Update to RDoc 4.2.0.alpha(313287)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rdoc/test_rdoc_parser_c.rb')
-rw-r--r-- | test/rdoc/test_rdoc_parser_c.rb | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/test/rdoc/test_rdoc_parser_c.rb b/test/rdoc/test_rdoc_parser_c.rb index 88d4660766..71ffce5f9a 100644 --- a/test/rdoc/test_rdoc_parser_c.rb +++ b/test/rdoc/test_rdoc_parser_c.rb @@ -736,6 +736,47 @@ rb_define_alias(C, "[]", "index"); assert_equal "/*\n * comment\n */\n\n", comment.text end + def test_find_attr_comment_document_attr + parser= util_parser <<-C +/* + * Document-attr: y + * comment + */ + C + + comment = parser.find_attr_comment nil, 'y' + + assert_equal "/*\n * \n * comment\n */", comment.text + end + + def test_find_attr_comment_document_attr_oneline + parser= util_parser <<-C +/* Document-attr: y + * comment + */ + C + + comment = parser.find_attr_comment nil, 'y' + + assert_equal "/* \n * comment\n */", comment.text + end + + def test_find_attr_comment_document_attr_overlap + parser= util_parser <<-C +/* Document-attr: x + * comment + */ + +/* Document-attr: y + * comment + */ + C + + comment = parser.find_attr_comment nil, 'y' + + assert_equal "/* \n * comment\n */", comment.text + end + def test_find_class_comment @options.rdoc_include << File.dirname(__FILE__) @@ -1205,6 +1246,36 @@ Init_Foo(void) { assert_equal "a comment for Foo#bar", bar.comment.text end + def test_find_body_macro + content = <<-EOF +/* + * a comment for other_function + */ +DLL_LOCAL VALUE +other_function() { +} + +void +Init_Foo(void) { + VALUE foo = rb_define_class("Foo", rb_cObject); + + rb_define_method(foo, "my_method", other_function, 0); +} + EOF + + klass = util_get_class content, 'foo' + other_function = klass.method_list.first + + assert_equal 'my_method', other_function.name + assert_equal "a comment for other_function", + other_function.comment.text + assert_equal '()', other_function.params + + code = other_function.token_stream.first.text + + assert_equal "DLL_LOCAL VALUE\nother_function() {\n}", code + end + def test_find_modifiers_call_seq comment = RDoc::Comment.new <<-COMMENT call-seq: |