# frozen_string_literal: true
require 'test_helper'
class TestXml < Minitest::Test
def setup
@markdown = <<~MD
Hi *there*!
1. I am a numeric list.
2. I continue the list.
* Suddenly, an unordered list!
* What fun!
Okay, _enough_.
| a | b |
| --- | --- |
| c | d |
MD
end
def render_doc(doc)
CommonMarker.render_doc(doc, :DEFAULT, [:table])
end
def test_to_xml
compare = render_doc(@markdown).to_xml(:SOURCEPOS)
assert_equal <<~XML, compare
Hi
there
!
-
I am a numeric list.
-
I continue the list.
-
Suddenly, an unordered list!
-
What fun!
Okay,
enough
.
XML
end
def test_to_xml_with_quotes
compare = render_doc('"quotes" should be escaped').to_xml(:DEFAULT)
assert_equal <<~XML, compare
"quotes" should be escaped
XML
end
end