diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-05 22:20:15 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-05 22:20:15 +0000 |
commit | 54c40f3db59d6875de0c2c0f47ab7edce0bd3f43 (patch) | |
tree | 6dc4fc7137f7d98e84fe01b7270ab08a2f22718f /test | |
parent | fe6b2e20e9f17ed2c2900aa72994e075ffdc7124 (diff) | |
download | ruby-54c40f3db59d6875de0c2c0f47ab7edce0bd3f43.tar.gz |
* lib/rdoc*: Improved display of ChangeLog files as HTML.
* test/rdoc*: Test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/rdoc/test_rdoc_markup_document.rb | 19 | ||||
-rw-r--r-- | test/rdoc/test_rdoc_markup_to_table_of_contents.rb | 31 | ||||
-rw-r--r-- | test/rdoc/test_rdoc_parser_changelog.rb | 32 |
3 files changed, 81 insertions, 1 deletions
diff --git a/test/rdoc/test_rdoc_markup_document.rb b/test/rdoc/test_rdoc_markup_document.rb index 564434dfe6..0ab87280eb 100644 --- a/test/rdoc/test_rdoc_markup_document.rb +++ b/test/rdoc/test_rdoc_markup_document.rb @@ -191,5 +191,24 @@ class TestRDocMarkupDocument < RDoc::TestCase assert_equal expected, doc.table_of_contents end + def test_table_of_contents_omit_headings_below + document = doc( + head(1, 'A'), + para('B'), + head(2, 'C'), + para('D'), + head(1, 'E'), + para('F')) + + document.omit_headings_below = 1 + + expected = [ + head(1, 'A'), + head(1, 'E'), + ] + + assert_equal expected, document.table_of_contents + end + end diff --git a/test/rdoc/test_rdoc_markup_to_table_of_contents.rb b/test/rdoc/test_rdoc_markup_to_table_of_contents.rb index fd0be746d8..ba17b845a7 100644 --- a/test/rdoc/test_rdoc_markup_to_table_of_contents.rb +++ b/test/rdoc/test_rdoc_markup_to_table_of_contents.rb @@ -91,5 +91,36 @@ class TestRDocMarkupToTableOfContents < RDoc::Markup::FormatterTestCase alias list_verbatim empty alias start_accepting empty + def test_accept_document_omit_headings_below + document = doc + document.omit_headings_below = 2 + + @to.accept_document document + + assert_equal 2, @to.omit_headings_below + end + + def test_accept_heading_suppressed + @to.start_accepting + @to.omit_headings_below = 4 + + suppressed = head 5, 'Hello' + + @to.accept_heading suppressed + + assert_empty @to.res + end + + def test_suppressed_eh + @to.omit_headings_below = nil + + refute @to.suppressed? head(1, '') + + @to.omit_headings_below = 1 + + refute @to.suppressed? head(1, '') + assert @to.suppressed? head(2, '') + end + end diff --git a/test/rdoc/test_rdoc_parser_changelog.rb b/test/rdoc/test_rdoc_parser_changelog.rb index be3b7145f3..2b8e591332 100644 --- a/test/rdoc/test_rdoc_parser_changelog.rb +++ b/test/rdoc/test_rdoc_parser_changelog.rb @@ -96,7 +96,17 @@ class TestRDocParserChangeLog < RDoc::TestCase expected.file = @top_level - assert_equal expected, parser.create_document(groups) + document = parser.create_document(groups) + + assert_equal expected, document + + assert_equal 2, document.omit_headings_below + + headings = document.parts.select do |part| + RDoc::Markup::Heading === part and part.level == 2 + end + + refute headings.all? { |heading| heading.text.frozen? } end def test_create_entries @@ -118,6 +128,26 @@ class TestRDocParserChangeLog < RDoc::TestCase list(:NOTE, item('c', para('three')), item('d', para('four'))), ] + entries = parser.create_entries(entries) + assert_equal expected, entries + end + + def test_create_entries_colons + parser = util_parser + + entries = [ + ['Wed Dec 5 12:17:11 2012 Naohisa Goto <ngotogenome@gmail.com>', + ['func.rb (DL::Function#bind): log stuff [ruby-core:50562]']], + ] + + expected = [ + head(3, + 'Wed Dec 5 12:17:11 2012 Naohisa Goto <ngotogenome@gmail.com>'), + blank_line, + list(:NOTE, + item('func.rb (DL::Function#bind)', + para('log stuff [ruby-core:50562]')))] + assert_equal expected, parser.create_entries(entries) end |