summaryrefslogtreecommitdiff
path: root/test/rdoc/test_rdoc_class_module.rb
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2019-01-22 04:46:46 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-07-26 17:20:58 +0800
commita86d4eef4b4551a48a5329bb993c3c6c39a1b1f3 (patch)
tree15c6b61eac64464b984b41d59906b02643ab372f /test/rdoc/test_rdoc_class_module.rb
parentf7cbbc707413f7e1c71ac1839b0c8834550451e6 (diff)
[ruby/rdoc] Normalization of comment should check language
RDoc::Text#normalize_comment that is included RDoc::Comment always remove Ruby style comment indicator "#" and C style comment indicator "/**/", but should check language and remove only the language's comment indicator. https://github.com/ruby/rdoc/commit/ca68ba1e73
Diffstat (limited to 'test/rdoc/test_rdoc_class_module.rb')
-rw-r--r--test/rdoc/test_rdoc_class_module.rb28
1 files changed, 15 insertions, 13 deletions
diff --git a/test/rdoc/test_rdoc_class_module.rb b/test/rdoc/test_rdoc_class_module.rb
index 138ede58b6..4dcc5d15ab 100644
--- a/test/rdoc/test_rdoc_class_module.rb
+++ b/test/rdoc/test_rdoc_class_module.rb
@@ -9,19 +9,19 @@ class TestRDocClassModule < XrefTestCase
tl3 = @store.add_file 'three.rb'
cm = RDoc::ClassModule.new 'Klass'
- comment_tl1 = RDoc::Comment.new('# comment 1')
+ comment_tl1 = RDoc::Comment.new('# comment 1', @top_level, :ruby)
cm.add_comment comment_tl1, tl1
assert_equal [[comment_tl1, tl1]], cm.comment_location
assert_equal 'comment 1', cm.comment.text
- comment_tl2 = RDoc::Comment.new('# comment 2')
+ comment_tl2 = RDoc::Comment.new('# comment 2', @top_level, :ruby)
cm.add_comment comment_tl2, tl2
assert_equal [[comment_tl1, tl1], [comment_tl2, tl2]], cm.comment_location
assert_equal "comment 1\n---\ncomment 2", cm.comment
- comment_tl3 = RDoc::Comment.new('# * comment 3')
+ comment_tl3 = RDoc::Comment.new('# * comment 3', @top_level, :ruby)
cm.add_comment comment_tl3, tl3
assert_equal [[comment_tl1, tl1],
@@ -42,11 +42,13 @@ class TestRDocClassModule < XrefTestCase
tl1 = @store.add_file 'one.rb'
cm = RDoc::ClassModule.new 'Klass'
- cm.add_comment '# comment 1', tl1
- cm.add_comment '# comment 2', tl1
+ comment1 = RDoc::Comment.new('# comment 1', @top_level, :ruby)
+ comment2 = RDoc::Comment.new('# comment 2', @top_level, :ruby)
+ cm.add_comment comment1, tl1
+ cm.add_comment comment2, tl1
- assert_equal [['comment 1', tl1],
- ['comment 2', tl1]], cm.comment_location
+ assert_equal [[comment1, tl1],
+ [comment2, tl1]], cm.comment_location
end
def test_add_comment_stopdoc
@@ -66,17 +68,17 @@ class TestRDocClassModule < XrefTestCase
def test_comment_equals
cm = RDoc::ClassModule.new 'Klass'
- cm.comment = '# comment 1'
+ cm.comment = RDoc::Comment.new('# comment 1', @top_level, :ruby)
- assert_equal 'comment 1', cm.comment
+ assert_equal 'comment 1', cm.comment.to_s
- cm.comment = '# comment 2'
+ cm.comment = RDoc::Comment.new('# comment 2', @top_level, :ruby)
- assert_equal "comment 1\n---\ncomment 2", cm.comment
+ assert_equal "comment 1\n---\ncomment 2", cm.comment.to_s
- cm.comment = "# * comment 3"
+ cm.comment = RDoc::Comment.new('# * comment 3', @top_level, :ruby)
- assert_equal "comment 1\n---\ncomment 2\n---\n* comment 3", cm.comment
+ assert_equal "comment 1\n---\ncomment 2\n---\n* comment 3", cm.comment.to_s
end
def test_comment_equals_comment