diff options
Diffstat (limited to 'test/rdoc/test_rdoc_tom_doc.rb')
-rw-r--r-- | test/rdoc/test_rdoc_tom_doc.rb | 60 |
1 files changed, 44 insertions, 16 deletions
diff --git a/test/rdoc/test_rdoc_tom_doc.rb b/test/rdoc/test_rdoc_tom_doc.rb index b22411f89f..63d3a5e79e 100644 --- a/test/rdoc/test_rdoc_tom_doc.rb +++ b/test/rdoc/test_rdoc_tom_doc.rb @@ -11,13 +11,6 @@ class TestRDocTomDoc < RDoc::TestCase @td = @TD.new end - def mu_pp obj - s = '' - s = PP.pp obj, s - s = s.force_encoding Encoding.default_external if defined? Encoding - s.chomp - end - def test_class_add_post_processor RDoc::TomDoc.add_post_processor @@ -135,6 +128,17 @@ here - something assert_equal expected, @TD.parse(text) end + def test_parse_multiline_paragraph + text = "Public: Do some stuff\n" + text << "On a new line\n" + + expected = + doc( + para('Do some stuff', ' ', 'On a new line')) + + assert_equal expected, @TD.parse(text) + end + def test_parse_arguments text = <<-TEXT Create new Arg object. @@ -188,7 +192,7 @@ foo - A comment goes here blank_line, list(:NOTE, item(%w[foo], - para('A comment goes here', 'and is more than one line')))) + para('A comment goes here', ' ', 'and is more than one line')))) assert_equal expected, @TD.parse(text) end @@ -279,13 +283,19 @@ Signature Do some stuff Returns a thing + +Returns another thing TEXT expected = - @RM::Document.new( - @RM::Paragraph.new('Do some stuff'), - @RM::BlankLine.new, - @RM::Paragraph.new('Returns a thing')) + doc( + para('Do some stuff'), + blank_line, + head(3, 'Returns'), + blank_line, + para('Returns a thing'), + blank_line, + para('Returns another thing')) assert_equal expected, @TD.parse(text) end @@ -299,10 +309,12 @@ Returns a thing TEXT expected = - @RM::Document.new( - @RM::Paragraph.new('Do some stuff'), - @RM::BlankLine.new, - @RM::Paragraph.new('Returns a thing', 'that is multiline')) + doc( + para('Do some stuff'), + blank_line, + head(3, 'Returns'), + blank_line, + para('Returns a thing', ' ', 'that is multiline')) assert_equal expected, @TD.parse(text) end @@ -338,6 +350,22 @@ Signature assert_equal expected, @td.tokens end + def test_tokenize_multiline_paragraph + text = "Public: Do some stuff\n" + text << "On a new line\n" + + @td.tokenize text + + expected = [ + [:TEXT, "Do some stuff", 0, 0], + [:NEWLINE, "\n", 13, 0], + [:TEXT, "On a new line", 0, 1], + [:NEWLINE, "\n", 13, 1] + ] + + assert_equal expected, @td.tokens + end + def test_tokenize_arguments @td.tokenize <<-TEXT Create new Arg object. |