diff options
Diffstat (limited to 'test/rdoc/test_rdoc_markup_parser.rb')
-rw-r--r-- | test/rdoc/test_rdoc_markup_parser.rb | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/test/rdoc/test_rdoc_markup_parser.rb b/test/rdoc/test_rdoc_markup_parser.rb index 98c16a18ef..e214c4defc 100644 --- a/test/rdoc/test_rdoc_markup_parser.rb +++ b/test/rdoc/test_rdoc_markup_parser.rb @@ -248,6 +248,23 @@ the time assert_equal expected, @RMP.parse(str).parts end + def test_parse_heading_empty + str = <<-STR +=== +* bullet + STR + + expected = [ + @RM::Heading.new(3, ''), + @RM::BlankLine.new, + @RM::List.new(:BULLET, *[ + @RM::ListItem.new(nil, + @RM::Paragraph.new('bullet'))]), + ] + + assert_equal expected, @RMP.parse(str).parts + end + def test_parse_heading_heading str = '= =' @@ -1085,6 +1102,23 @@ the time assert_equal expected, @RMP.tokenize(str) end + def test_tokenize_heading_empty + str = <<-STR +=== +* bullet + STR + + expected = [ + [:HEADER, 3, 0, 0], + [:NEWLINE, "\n", 3, 0], + [:BULLET, "*", 0, 1], + [:TEXT, "bullet", 2, 1], + [:NEWLINE, "\n", 8, 1], + ] + + assert_equal expected, @RMP.tokenize(str) + end + def test_tokenize_heading_heading str = <<-STR = = @@ -1366,6 +1400,44 @@ Example heading: assert_equal expected, @RMP.tokenize(str) end + def test_tokenize_verbatim_rule + str = <<-STR + Verbatim section here that is double-underlined + =============================================== + STR + + expected = [ + [:TEXT, 'Verbatim section here that is double-underlined', 2, 0], + [:NEWLINE, "\n", 49, 0], + [:HEADER, 47, 2, 1], + [:NEWLINE, "\n", 49, 1], + ] + + assert_equal expected, @RMP.tokenize(str) + end + + def test_tokenize_verbatim_rule_fancy + str = <<-STR + A + b + =============================================== + c + STR + + expected = [ + [:TEXT, 'A', 2, 0], + [:NEWLINE, "\n", 3, 0], + [:TEXT, 'b', 4, 1], + [:NEWLINE, "\n", 5, 1], + [:HEADER, 47, 2, 2], + [:NEWLINE, "\n", 49, 2], + [:TEXT, 'c', 4, 3], + [:NEWLINE, "\n", 5, 3], + ] + + assert_equal expected, @RMP.tokenize(str) + end + # HACK move to Verbatim test case def test_verbatim_normalize v = @RM::Verbatim.new "foo\n", "\n", "\n", "bar\n" |