From 1b43644edc85a93bfc9228588c065c87f975cd93 Mon Sep 17 00:00:00 2001 From: aycabta Date: Wed, 17 Oct 2018 06:28:20 +0000 Subject: Merge rdoc-6.1.0.beta2 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/rdoc/test_rdoc_parser_ruby.rb | 66 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) (limited to 'test/rdoc/test_rdoc_parser_ruby.rb') diff --git a/test/rdoc/test_rdoc_parser_ruby.rb b/test/rdoc/test_rdoc_parser_ruby.rb index 8a3e723614..8188318769 100644 --- a/test/rdoc/test_rdoc_parser_ruby.rb +++ b/test/rdoc/test_rdoc_parser_ruby.rb @@ -495,6 +495,43 @@ ruby assert_equal 'my attr', bar.comment.text end + def test_parse_attr_accessor_with_newline + klass = RDoc::NormalClass.new 'Foo' + klass.parent = @top_level + + comment = RDoc::Comment.new "##\n# my attr\n", @top_level + + util_parser "attr_accessor :foo, :bar,\n :baz,\n :qux" + + tk = @parser.get_tk + + @parser.parse_attr_accessor klass, RDoc::Parser::Ruby::NORMAL, tk, comment + + assert_equal 4, klass.attributes.length + + foo = klass.attributes[0] + assert_equal 'foo', foo.name + assert_equal 'RW', foo.rw + assert_equal 'my attr', foo.comment.text + assert_equal @top_level, foo.file + assert_equal 1, foo.line + + bar = klass.attributes[1] + assert_equal 'bar', bar.name + assert_equal 'RW', bar.rw + assert_equal 'my attr', bar.comment.text + + bar = klass.attributes[2] + assert_equal 'baz', bar.name + assert_equal 'RW', bar.rw + assert_equal 'my attr', bar.comment.text + + bar = klass.attributes[3] + assert_equal 'qux', bar.name + assert_equal 'RW', bar.rw + assert_equal 'my attr', bar.comment.text + end + def test_parse_attr_accessor_nodoc klass = RDoc::NormalClass.new 'Foo' klass.parent = @top_level @@ -2848,6 +2885,35 @@ EXPECTED assert_equal expected, markup_code end + def test_parse_mutable_heredocbeg + @filename = 'file.rb' + util_parser <def blah() + @str = -<<-EOM + EOM + end +EXPECTED + expected = expected.rstrip + + @parser.scan + + foo = @top_level.classes.first + assert_equal 'Foo', foo.full_name + + blah = foo.method_list.first + markup_code = blah.markup_code.sub(/^.*\n/, '') + assert_equal expected, markup_code + end + def test_parse_statements_method_oneliner_with_regexp util_parser <