diff options
Diffstat (limited to 'test/rdoc/test_rdoc_generator_darkfish.rb')
-rw-r--r-- | test/rdoc/test_rdoc_generator_darkfish.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/test/rdoc/test_rdoc_generator_darkfish.rb b/test/rdoc/test_rdoc_generator_darkfish.rb index 6a3e7038e1..352e9336ff 100644 --- a/test/rdoc/test_rdoc_generator_darkfish.rb +++ b/test/rdoc/test_rdoc_generator_darkfish.rb @@ -43,10 +43,13 @@ class TestRDocGeneratorDarkfish < RDoc::TestCase @meth = RDoc::AnyMethod.new nil, 'method' @meth_bang = RDoc::AnyMethod.new nil, 'method!' + @meth_with_html_tag_yield = RDoc::AnyMethod.new nil, 'method_with_html_tag_yield' + @meth_with_html_tag_yield.block_params = '%<<script>alert("atui")</script>>, yield_arg' @attr = RDoc::Attr.new nil, 'attr', 'RW', '' @klass.add_method @meth @klass.add_method @meth_bang + @klass.add_method @meth_with_html_tag_yield @klass.add_attribute @attr @ignored = @top_level.add_class RDoc::NormalClass, 'Ignored' @@ -167,7 +170,7 @@ class TestRDocGeneratorDarkfish < RDoc::TestCase assert_equal [@klass_alias, @ignored, @klass, @object], @g.classes.sort_by { |klass| klass.full_name } assert_equal [@top_level], @g.files - assert_equal [@meth, @meth, @meth_bang, @meth_bang], @g.methods + assert_equal [@meth, @meth, @meth_bang, @meth_bang, @meth_with_html_tag_yield, @meth_with_html_tag_yield], @g.methods assert_equal [@klass_alias, @klass, @object], @g.modsort end @@ -199,6 +202,23 @@ class TestRDocGeneratorDarkfish < RDoc::TestCase assert_same template, @g.send(:template_for, partial) end + def test_generated_method_with_html_tag_yield + top_level = @store.add_file 'file.rb' + top_level.add_class @klass.class, @klass.name + + @g.generate + + path = File.join @tmpdir, 'A.html' + + f = open(path) + internal_file = f.read + method_name_index = internal_file.index('<span class="method-name">method_with_html_tag_yield</span>') + last_of_method_name_index = method_name_index + internal_file[method_name_index..-1].index('<div class="method-description">') - 1 + method_name = internal_file[method_name_index..last_of_method_name_index] + + assert_includes method_name, '{ |%<<script>alert("atui")</script>>, yield_arg| ... }' + end + ## # Asserts that +filename+ has a link count greater than 1 if hard links to # @tmpdir are supported. |