aboutsummaryrefslogtreecommitdiffstats
path: root/test/rdoc/test_rdoc_tom_doc.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-18 23:33:36 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-18 23:33:36 +0000
commitdf7dac9174a31e71b58be6184e23bfe6b742a494 (patch)
tree885edf624f0e8f37014b0d937340ac1c372a0066 /test/rdoc/test_rdoc_tom_doc.rb
parentfed428007c015ac3b7f4586f2491517fafffa030 (diff)
downloadruby-df7dac9174a31e71b58be6184e23bfe6b742a494.tar.gz
* lib/rdoc: Update to RDoc 4.1.0.preview.1
RDoc 4.1.0 contains a number of enhancements including a new default style and accessibility support. You can see the changelog here: https://github.com/rdoc/rdoc/blob/v4.1.0.preview.1/History.rdoc * test/rdoc: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rdoc/test_rdoc_tom_doc.rb')
-rw-r--r--test/rdoc/test_rdoc_tom_doc.rb60
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.