@@ -43,10 +43,13 @@ def setup
4343
4444 @meth = RDoc ::AnyMethod . new nil , 'method'
4545 @meth_bang = RDoc ::AnyMethod . new nil , 'method!'
46+ @meth_with_html_tag_yield = RDoc ::AnyMethod . new nil , 'method_with_html_tag_yield'
47+ @meth_with_html_tag_yield . block_params = '%<<script>alert("atui")</script>>, yield_arg'
4648 @attr = RDoc ::Attr . new nil , 'attr' , 'RW' , ''
4749
4850 @klass . add_method @meth
4951 @klass . add_method @meth_bang
52+ @klass . add_method @meth_with_html_tag_yield
5053 @klass . add_attribute @attr
5154
5255 @ignored = @top_level . add_class RDoc ::NormalClass , 'Ignored'
@@ -167,7 +170,7 @@ def test_setup
167170 assert_equal [ @klass_alias , @ignored , @klass , @object ] ,
168171 @g . classes . sort_by { |klass | klass . full_name }
169172 assert_equal [ @top_level ] , @g . files
170- assert_equal [ @meth , @meth , @meth_bang , @meth_bang ] , @g . methods
173+ assert_equal [ @meth , @meth , @meth_bang , @meth_bang , @meth_with_html_tag_yield , @meth_with_html_tag_yield ] , @g . methods
171174 assert_equal [ @klass_alias , @klass , @object ] , @g . modsort
172175 end
173176
@@ -199,6 +202,23 @@ def test_template_for_partial
199202 assert_same template , @g . send ( :template_for , partial )
200203 end
201204
205+ def test_generated_method_with_html_tag_yield
206+ top_level = @store . add_file 'file.rb'
207+ top_level . add_class @klass . class , @klass . name
208+
209+ @g . generate
210+
211+ path = File . join @tmpdir , 'A.html'
212+
213+ f = open ( path )
214+ internal_file = f . read
215+ method_name_index = internal_file . index ( '<span class="method-name">method_with_html_tag_yield</span>' )
216+ last_of_method_name_index = method_name_index + internal_file [ method_name_index ..-1 ] . index ( '<div class="method-description">' ) - 1
217+ method_name = internal_file [ method_name_index ..last_of_method_name_index ]
218+
219+ assert_includes method_name , '{ |%<<script>alert("atui")</script>>, yield_arg| ... }'
220+ end
221+
202222 ##
203223 # Asserts that +filename+ has a link count greater than 1 if hard links to
204224 # @tmpdir are supported.
0 commit comments